<template>
  <div id="youngcadresedit">
    <div v-if="pageLoading">数据加载中...</div>
    <div v-else style="padding-top:10px;">
      <div>
        <el-tabs v-model="activeName" type="card" @tab-click="tabClick" style="margin:0 0 0 10px" id="recruitUnitTabs">
          <el-tab-pane name="personInfo" label="人员" v-if="addType==='person'">
            <el-form :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message :rules="editFormRules">
              <table cellspacing="0" cellpadding="0" class="mytable">
                <tr>
                  <th style="width:220px">姓名</th>
                  <td>
                    <el-form-item prop="realname">
                      <el-input v-model="editForm.realname" style="width:100px"></el-input>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>身份证号</th>
                  <td>
                    <el-form-item prop="idCardNo">
                      <el-input v-model.trim="editForm.idCardNo" style="width:200px" @change="idCardNoChange"></el-input>
                    </el-form-item>
                  </td>
                </tr>
              </table>
            </el-form>
            <el-button type="primary" @click.native="submitPerson" :loading="saveloading" style="margin-top:10px;">保存</el-button>
          </el-tab-pane>
          <el-tab-pane name="table" label="审批表" v-if="addType==='approval'">
            <h2>自然资源部直属事业单位局级干部基本工资变动审批表</h2>
            <div v-if="formType==='detail'">
              <el-form :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message :rules="editFormRules">
                <table cellspacing="0" cellpadding="0" class="mytable">
                  <tr v-if="editForm.state===3">
                    <th>状态</th>
                    <td style="width:220px">
                      <span style="color:red;font-weight:bolder">退回</span>
                    </td>
                    <th>退回时间</th>
                    <td style="width:230px">
                      {{editForm.backDatetime}}
                    </td>
                    <th>退回原因</th>
                    <td style="width:230px">
                      {{editForm.backReason}}
                    </td>
                  </tr>
                  <tr>
                    <th>变动原因</th>
                    <td colspan="3">
                      {{fReasonText(editForm.reason)}}
                    </td>
                    <th>变动年度</th>
                    <td>
                      {{editForm.theYear}}
                    </td>
                  </tr>
                  <tr>
                    <th>姓名</th>
                    <td style="width:220px">
                      {{editForm.realName}}
                    </td>
                    <th>性别</th>
                    <td style="width:230px">
                      {{editForm.gender?sexList.find(item=>item.value===editForm.gender).label:''}}
                    </td>
                    <th>出生年月</th>
                    <td style="width:230px">
                      {{formatDate(editForm.birthday)}}
                    </td>
                  </tr>
                  <tr>
                    <th>身份证号</th>
                    <td style="width:230px">
                      {{editForm.idCardNo}}
                    </td>
                    <th>文化程度</th>
                    <td>
                      {{editForm.education}}
                    </td>
                    <th>参加工作时间</th>
                    <td>
                      {{formatDate(editForm.jobDate)}}
                    </td>
                  </tr>
                  <tr>
                    <th>工作单位及职务</th>
                    <td colspan="3">
                      {{editForm.unitName}}
                    </td>
                    <th>任职时间</th>
                    <td>
                      {{formatDate(editForm.currentJobDate)}}
                    </td>
                  </tr>
                  <tr>
                    <th colspan="6">变动情况</th>
                  </tr>
                  <tr>
                    <th colspan="2">项目</th>
                    <th>变动前</th>
                    <th>变动后</th>
                    <th colspan="2">增资额</th>
                  </tr>
                  <tr>
                    <th colspan="2">参照标准</th>
                    <td style="text-align:center">
                      {{standardFun(editForm.standard1)}}
                    </td>
                    <td style="text-align:center">
                      {{standardFun(editForm.standard2)}}
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th colspan="2">岗位类别</th>
                    <td style="text-align:center">
                      {{editForm.jobClass1}}
                    </td>
                    <td style="text-align:center">
                      {{editForm.jobClass2}}
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th colspan="1" rowspan="2">岗位工资</th>
                    <th>岗位等级</th>
                    <td style="text-align:center">
                      <span v-if="editForm.jobClass1 === '专业技术岗位' && editForm.jobLevel1">
                        <span>{{'专业技术' + editForm.jobLevel1}}</span>
                      </span>
                      <span v-else-if="editForm.jobClass1 === '管理岗位' && editForm.jobLevel1">
                        <span>{{'管理' + editForm.jobLevel1}}</span>
                      </span>
                      <span v-else>
                        <span>{{editForm.jobLevel1}}</span>
                      </span>
                    </td>
                    <td style="text-align:center">
                      <span v-if="editForm.jobClass2 === '专业技术岗位' && editForm.jobLevel2">
                        <span>{{'专业技术' + editForm.jobLevel2}}</span>
                      </span>
                      <span v-else-if="editForm.jobClass2 === '管理岗位' && editForm.jobLevel2">
                        <span>{{'管理' + editForm.jobLevel2}}</span>
                      </span>
                      <span v-else>
                        <span>{{editForm.jobLevel2}}</span>
                      </span>
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th>工资标准</th>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.jobSalary1}}</div>
                    </td>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.jobSalary2}}</div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.jobSalary3}}</div>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="1" rowspan="2">薪级工资</th>
                    <th>薪级</th>
                    <td style="text-align:center">
                      {{editForm.salaryLevel1}}
                      <div v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24">
                        理论值：
                        <span :style="'color:'+((editForm.salaryLevel32===editForm.salaryLevel1)?'green':'red')+';font-size:20px;font-weight:bolder'">{{editForm.salaryLevel32}}</span>
                      </div>
                    </td>
                    <td style="text-align:center">
                      {{editForm.salaryLevel2}}
                      <div v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24">
                        理论值：
                        <span :style="'color:'+((editForm.salaryLevel3===editForm.salaryLevel2)?'green':'red')+';font-size:20px;font-weight:bolder'">{{editForm.salaryLevel3}}</span>
                      </div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th>工资标准</th>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.levelSalary1}}</div>
                    </td>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.levelSalary2}}</div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.levelSalary3}}</div>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="2">合计</th>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.salary1}}</div>
                    </td>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.salary2}}</div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.salary3}}</div>
                    </td>
                  </tr>
                  <tr v-if="editForm.salaryLevel1!==editForm.salaryLevel32 && editForm.salaryLevel32">
                    <th colspan="2">变动前薪级级别与理论值不符，请说明原因</th>
                    <td colspan="4">
                      {{editForm.description2}}
                    </td>
                  </tr>
                  <tr v-if="editForm.salaryLevel2!==editForm.salaryLevel3 && editForm.salaryLevel3">
                    <th colspan="2">变动后薪级级别与理论值不符，请说明原因</th>
                    <td colspan="4">
                      {{editForm.description}}
                    </td>
                  </tr>
                  <tr>
                    <th colspan="2">执行时间</th>
                    <td colspan="4">
                      自 {{formatExecuteDate(editForm.salaryDate)}} 起执行
                    </td>
                  </tr>
                  <tr>
                    <th>备注</th>
                    <td colspan="5">
                      {{editForm.remarks}}
                    </td>
                  </tr>
                  <tr v-if="editForm.reason===11 || editForm.reason===12 || editForm.reason===13">
                    <th>任职发文</th>
                    <td colspan="5">
                      <div>
                        <div v-for="(item,index) in editForm.files2" :key="index">
                          <el-link
                            :href="$http.defaults.baseURL+$http.defaults.salaryAPI+'api/salaryGenFileInfo/download?id='+item.id"
                            icon="el-icon-paperclip"
                          >{{ item.fileName+(item.fileType?'.'+item.fileType:'') }}</el-link>
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <th>其他证明材料</th>
                    <td colspan="5">
                      <div>
                        <div v-for="(item,index) in editForm.files" :key="index">
                          <el-link
                            :href="$http.defaults.baseURL+$http.defaults.salaryAPI+'api/salaryGenFileInfo/download?id='+item.id"
                            icon="el-icon-paperclip"
                          >{{ item.fileName+(item.fileType?'.'+item.fileType:'') }}</el-link>
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr v-if="editForm.state===1&&unitId">
                    <th>审批</th>
                    <td colspan="5">
                      <el-radio-group v-model="passed">
                        <el-radio :label="2">通过</el-radio>
                        <el-radio :label="3">退回</el-radio>
                      </el-radio-group>
                      <div v-if="passed===3">
                        请输入退回原因<br />
                        <el-input type="textarea" v-model="bz" style="width:100%"></el-input>
                      </div>
                    </td>
                  </tr>
                </table>
              </el-form>
              <div v-if="editForm.state===1" style="margin:0 10px">
                <el-button v-if="unitId" type="primary" @click.native="submitApproval2" :loading="saveloading">提交</el-button>
                <el-button @click.native="exportApprocal" style="margin-top:10px;">导出审批表</el-button>
                <el-button :loading="exportLoading" v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24" @click.native="exportOthers" style="margin-top:10px;">导出薪级工资理论值测算表</el-button>
              </div>
              <div v-if="editForm.state===0||editForm.state===3" style="margin:0 10px">
                <el-button type="primary" @click.native="handleEdit" style="margin-top:10px;">修改</el-button>
                <el-button type="danger" @click.native="handleDel" :loading="saveloading" style="margin-top:10px;">删除</el-button>
                <el-button type="success" @click.native="submitApproval(1)" :loading="saveloading" style="margin-top:10px;">提交</el-button>
                <el-button @click.native="exportApprocal" style="margin-top:10px;">导出审批表</el-button>
                <el-button :loading="exportLoading" v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24" @click.native="exportOthers" style="margin-top:10px;">导出薪级工资理论值测算表</el-button>
              </div>
              <div v-if="editForm.state===2" style="margin:0 10px">
                <el-button @click.native="exportApprocal" style="margin-top:10px;">导出审批表</el-button>
                <el-button :loading="exportLoading" v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24" @click.native="exportOthers" style="margin-top:10px;">导出薪级工资理论值测算表</el-button>
              </div>
            </div>
            <div v-else>
              <el-form :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message :rules="editFormRules">
                <table cellspacing="0" cellpadding="0" class="mytable">
                  <tr>
                    <th>变动原因</th>
                    <td colspan="3">
                      <el-form-item prop="reason">
                        <el-select v-model="editForm.reason" style="width:350px">
                          <el-option-group
                            v-for="group in reasonList"
                            :key="group.label"
                            :label="group.label">
                            <el-option
                              v-for="item in group.options"
                              :key="item.value"
                              :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-option-group>
                        </el-select>
                      </el-form-item>
                    </td>
                    <th>变动年度</th>
                    <td>
                      <el-form-item prop="theYear">
                        <el-date-picker v-model="editForm.theYear" type="year" placeholder="选择年度" format="yyyy" value-format="yyyy" @change="yearChange"></el-date-picker>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr>
                    <th>姓名</th>
                    <td style="width:220px">
                      {{editForm.realName}}
                    </td>
                    <th>性别</th>
                    <td style="width:230px">
                      <el-form-item prop="gender">
                        <el-select v-model="editForm.gender" style="width:150px">
                          <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <th>出生年月</th>
                    <td style="width:230px">
                      <el-form-item prop="birthday">
                        <el-input v-model="editForm.birthday" style="width:100px"></el-input>
                        <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                          <el-button type="text" icon="el-icon-info" />
                        </el-tooltip>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr>
                    <th>身份证号</th>
                    <td style="width:230px">
                      {{editForm.idCardNo}}
                    </td>
                    <th>文化程度</th>
                    <td>
                      <el-form-item prop="education">
                        <el-select v-model="editForm.education" style="width:150px">
                          <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <th>参加工作时间</th>
                    <td>
                      <el-form-item prop="jobDate">
                        <el-input v-model="editForm.jobDate" style="width:100px"></el-input>
                        <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                          <el-button type="text" icon="el-icon-info" />
                        </el-tooltip>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr>
                    <th>工作单位及职务</th>
                    <td colspan="3">
                      <el-form-item prop="unitName">
                        <el-input v-model="editForm.unitName" style="width:600px"></el-input>
                      </el-form-item>
                    </td>
                    <th>任职时间</th>
                    <td>
                      <el-form-item prop="currentJobDate">
                        <el-input v-model="editForm.currentJobDate" style="width:100px" @blur="currentJobDateBlur"></el-input>
                        <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                          <el-button type="text" icon="el-icon-info" />
                        </el-tooltip>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="6">变动情况</th>
                  </tr>
                  <tr>
                    <th colspan="2">项目</th>
                    <th>变动前</th>
                    <th>变动后</th>
                    <th colspan="2">增资额</th>
                  </tr>
                  <tr>
                    <th colspan="2">参照标准</th>
                    <td style="text-align:center">
                      <el-form-item prop="standard1">
                        <el-select v-model="editForm.standard1" style="width:250px" @change="filterFun1">
                          <el-option v-for="(item,index) in standardList" :key="'standard1_'+index" :value="item.id" :label="item.standardType" />
                          <el-option :value="0" label="其他标准" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <td style="text-align:center">
                      <el-form-item prop="standard2">
                        <el-select v-model="editForm.standard2" style="width:250px" @change="filterFun2">
                          <el-option v-for="(item,index) in standardList" :key="'standard2_'+index" :value="item.id" :label="item.standardType" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th colspan="2">岗位类别</th>
                    <td style="text-align:center">
                      <el-form-item prop="jobClass1">
                        <el-input v-model="editForm.jobClass1" style="width:250px" v-if="editForm.standard1===0"/>
                        <el-select v-model="editForm.jobClass1" style="width:250px" v-else @change="filterFun1">
                          <el-option v-for="(item,index) in postArr" :key="'post1_'+index" :value="item.value" :label="item.label" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <td style="text-align:center">
                      <el-form-item prop="jobClass2">
                        <el-select v-model="editForm.jobClass2" style="width:250px" @change="filterFun2">
                          <el-option v-for="(item,index) in postArr.filter(item=>item.type===1)" :key="'post2_'+index" :value="item.value" :label="item.label" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th colspan="1" rowspan="2">岗位工资</th>
                    <th>岗位等级</th>
                    <td style="text-align:center">
                      <el-form-item prop="jobLevel1">
                        <el-input v-model="editForm.jobLevel1" style="width:150px" v-if="editForm.standard1===0||editForm.jobClass1==='公务员'||editForm.jobClass1==='军转'||editForm.jobClass1==='企业'"/>
                        <el-select v-model="editForm.jobLevel1" style="width:150px" v-else @focus="tooltipFun1" @change="jobLevelChange1">
                          <el-option v-for="(item,index) in jobLevelList1" :key="'jobLevelList1_'+index" :value="item.level" :label="item.level" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <td style="text-align:center">
                      <el-form-item prop="jobLevel2">
                        <el-select v-model="editForm.jobLevel2" style="width:150px" @focus="tooltipFun2" @change="jobLevelChange2">
                          <el-option v-for="(item,index) in jobLevelList2" :key="'jobLevelList2_'+index" :value="item.level" :label="item.level" />
                        </el-select>
                      </el-form-item>
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th>工资标准</th>
                    <td style="text-align:center">
                      <el-form-item prop="jobSalary1" v-if="editForm.standard1===0||editForm.jobClass1==='公务员'||editForm.jobClass1==='军转'||editForm.jobClass1==='企业'">
                        <el-input-number :min="0" v-model="editForm.jobSalary1" style="width:250px" @change="count1"/>
                      </el-form-item>
                      <div style="font-size:20px;font-weight:bolder" v-else>{{editForm.jobSalary1}}</div>
                    </td>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.jobSalary2}}</div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.jobSalary3}}</div>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="1" rowspan="2">薪级工资</th>
                    <th>薪级</th>
                    <td style="text-align:center">
                      <el-form-item prop="salaryLevel1">
                        <el-input v-model="editForm.salaryLevel1" style="width:150px" v-if="editForm.standard1===0||editForm.jobClass1==='公务员'||editForm.jobClass1==='军转'||editForm.jobClass1==='企业'"/>
                        <el-select v-model="editForm.salaryLevel1" style="width:150px" v-else @focus="tooltipFun1" @change="salaryLevelChange1">
                          <el-option v-for="(item,index) in salaryLevelList1" :key="'salaryLevelList1_'+index" :value="item.level" :label="item.level" />
                        </el-select>
                      </el-form-item>
                      <div v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24">
                        理论值：
                        <span :style="'color:'+((editForm.salaryLevel32===editForm.salaryLevel1)?'green':'red')+';font-size:20px;font-weight:bolder'">{{editForm.salaryLevel32}}</span>
                      </div>
                    </td>
                    <td style="text-align:center">
                      <el-form-item prop="salaryLevel2">
                        <el-select v-model="editForm.salaryLevel2" style="width:150px" @focus="tooltipFun2" @change="salaryLevelChange2">
                          <el-option v-for="(item,index) in salaryLevelList2" :key="'salaryLevelList2_'+index" :value="item.level" :label="item.level" />
                        </el-select>
                      </el-form-item>
                      <div v-if="editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24">
                        理论值：
                        <span :style="'color:'+((editForm.salaryLevel3===editForm.salaryLevel2)?'green':'red')+';font-size:20px;font-weight:bolder'">{{editForm.salaryLevel3}}</span>
                      </div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      ——
                    </td>
                  </tr>
                  <tr>
                    <th>工资标准</th>
                    <td style="text-align:center">
                      <el-form-item prop="levelSalary1" v-if="editForm.standard1===0||editForm.jobClass1==='公务员'||editForm.jobClass1==='军转'||editForm.jobClass1==='企业'">
                        <el-input-number :min="0" v-model="editForm.levelSalary1" style="width:250px" @change="count2"/>
                      </el-form-item>
                      <div style="font-size:20px;font-weight:bolder" v-else>{{editForm.levelSalary1}}</div>
                    </td>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.levelSalary2}}</div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.levelSalary3}}</div>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="2">合计</th>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.salary1}}</div>
                    </td>
                    <td style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.salary2}}</div>
                    </td>
                    <td colspan="2" style="text-align:center">
                      <div style="font-size:20px;font-weight:bolder">{{editForm.salary3}}</div>
                    </td>
                  </tr>
                  <tr v-if="editForm.salaryLevel1!==editForm.salaryLevel32 && editForm.salaryLevel32">
                    <th colspan="2">变动前薪级级别与理论值不符，请说明原因</th>
                    <td colspan="4">
                      <el-form-item prop="description2">
                        <el-input v-model="editForm.description2" style="width:800px"></el-input>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr v-if="editForm.salaryLevel2!==editForm.salaryLevel3 && editForm.salaryLevel3">
                    <th colspan="2">变动后薪级级别与理论值不符，请说明原因</th>
                    <td colspan="4">
                      <el-form-item prop="description">
                        <el-input v-model="editForm.description" style="width:800px"></el-input>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="2">执行时间</th>
                    <td colspan="4">
                      <el-form-item prop="salaryDate">
                        自 <el-input v-model="editForm.salaryDate" style="width:200px"></el-input> 起执行
                        <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                          <el-button type="text" icon="el-icon-info" />
                        </el-tooltip>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr>
                    <th>备注</th>
                    <td colspan="5">
                      <el-form-item prop="remarks">
                        <el-input v-model="editForm.remarks" style="width:800px"></el-input>
                        <span v-if="editForm.reason===11 || editForm.reason===12 || editForm.reason===13" style="font-size: 14px; color: red; font-weight: bolder;">请填写部党组会通过时间以及任职发文文号</span>
                      </el-form-item>
                    </td>
                  </tr>
                  <tr v-if="editForm.reason===11 || editForm.reason===12 || editForm.reason===13">
                    <th>任职发文</th>
                    <td colspan="5">
                      <el-button type="primary" :loading="saveloading" @click="uploadOfficeDocument()">上传</el-button>
                        <span style="font-size: 14px; color: red; font-weight: bolder;">请上传任职发文</span>
                      <el-upload
                        style="width:800px;margin-top:-20px;"
                        ref="uploadOfficeDocumentRef"
                        :action="this.$http.defaults.baseURL+this.$http.defaults.salaryAPI +'api/salaryGenFileInfo/upload'"
                        :on-success="handleUploadSucc4"
                        :on-error="uploadError"
                        :before-upload="beforeUpload"
                        accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps"
                        :file-list="fileList4"
                        :before-remove="beforeRemove"
                        :on-remove="handleRemove4"
                      >
                      </el-upload>
                    </td>
                  </tr>
                  <tr>
                    <th>其他证明材料</th>
                    <td colspan="5">
                      <el-upload
                        style="width:800px;margin-bottom:10px;"
                        ref="upload"
                        :action="this.$http.defaults.baseURL+this.$http.defaults.salaryAPI +'api/salaryGenFileInfo/upload'"
                        :on-success="handleUploadSucc"
                        :on-error="uploadError"
                        :before-upload="beforeUpload"
                        accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps"
                        :file-list="fileList"
                        :before-remove="beforeRemove"
                        :on-remove="handleRemove"
                      >
                        <el-button type="primary" :loading="saveloading">上传</el-button>
                        <span style="font-size: 14px; color: red; font-weight: bolder;">请上传证明材料</span>
                        <!-- <div slot="tip" class="el-upload__tip">注：支持上传word/pdf/wps文件</div>
                        <div style="clear:both" /> -->
                      </el-upload>
                      <!-- <div>
                        <div v-for="(item,index) in editForm.files" :key="index" style="width:600px;height:40px;">
                          <el-button style="margin-left:10px;float:right" size="mini" type="danger" @click="beforeRemove(item)">删除</el-button>
                          <el-link
                            :href="$http.defaults.baseURL+$http.defaults.salaryAPI+'api/salaryGenFileInfo/download?id='+item.id"
                            icon="el-icon-paperclip"
                          >{{ item.name }}</el-link>
                        </div>
                      </div> -->
                    </td>
                  </tr>
                </table>
              </el-form>
              <div style="margin:0 10px">
                <el-button type="primary" @click.native="submitApproval(0)" :loading="saveloading" style="margin-top:10px;">暂存</el-button>
                <el-button type="success" @click.native="submitApproval(1)" :loading="saveloading" style="margin-top:10px;">提交</el-button>
              </div>
              <!-- <el-button @click.native="backToList" style="margin-top:10px;">导出审批表</el-button> -->
            </div>
          </el-tab-pane>
          <!-- <el-tab-pane name="basicInfo" label="基本信息" v-if="addType==='approval'">
            <el-form :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message>
              <table cellspacing="0" cellpadding="0" class="mytable">
                <tr>
                  <th>姓名</th>
                  <td style="width:220px">
                    <el-form-item prop="realname">
                      <el-input v-model="editForm.realname" style="width:100px"></el-input>
                    </el-form-item>
                  </td>
                  <th>性别</th>
                  <td style="width:230px">
                    <el-select v-model="editForm.sex" style="width:150px">
                      <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                    </el-select>
                  </td>
                  <th>出生年月</th>
                  <td style="width:230px">
                    <el-form-item prop="birthday">
                      <el-input v-model="editForm.birthday" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>身份证号</th>
                  <td style="width:230px">
                    <el-form-item prop="idCardNo">
                      <el-input v-model="editForm.idCardNo" style="width:200px"></el-input>
                      <el-button type="primary" @click.native="backToList" style="margin-top:10px;">根据该身份证号最近一次工资变动信息初始化</el-button>
                    </el-form-item>
                  </td>
                  <th>文化程度</th>
                  <td>
                    <el-form-item prop="education">
                      <el-select v-model="editForm.education" style="width:150px">
                        <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                      </el-select>
                    </el-form-item>
                  </td>
                  <th>参加工作时间</th>
                  <td>
                    <el-form-item prop="jobDate">
                      <el-input v-model="editForm.jobDate" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>工作单位及职务</th>
                  <td colspan="3">
                    <el-form-item prop="unit">
                      <el-input v-model="editForm.unit" style="width:600px"></el-input>
                    </el-form-item>
                  </td>
                  <th>任职时间</th>
                  <td>
                    <el-form-item prop="currentJobDate">
                      <el-input v-model="editForm.currentJobDate" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                  </td>
                </tr>
              </table>
            </el-form>
            <el-button type="primary" @click.native="backToList" style="margin-top:10px;">保存</el-button>
          </el-tab-pane> -->
          <el-tab-pane name="others" label="薪级工资理论值测算" v-if="addType==='approval'&&(editForm.reason===11||editForm.reason===12||editForm.reason===13||editForm.reason===24)">
            <div v-if="editForm.state===0||editForm.state===3">
              <el-button type="primary" v-if="eduList.length===0&&jobList.length===0&&assessList.length===0" @click.native="saveInit" :loading="btnLoading">根据该人员最近一次工资变动信息初始化</el-button>
              <el-button type="success" @click.native="createChanges()" :loading="btnLoading">测算变动后薪级工资理论值</el-button>
              <el-button v-if="isShowChangeBefore" type="primary" @click.native="createChanges2()" :loading="btnLoading">测算变动前薪级工资理论值</el-button>
            </div>
            <el-tabs v-model="activeName2">
              <el-tab-pane name="education" label="学历信息">
                <el-drawer
                  :title="formTitle"
                  :visible.sync="eduDrawer"
                  direction="rtl"
                  append-to-body
                  >
                  <el-form :model="eduForm" label-width="150px" ref="eduForm" style="padding:10px 0 0;clear:both" inline-message :rules="eduFormRules">
                    <el-form-item prop="education" label="学历">
                      <el-select v-model="eduForm.education">
                        <el-option
                          label="博士研究生"
                          value="博士研究生">
                        </el-option>
                        <el-option
                          label="硕士研究生"
                          value="硕士研究生">
                        </el-option>
                        <el-option
                          label="未获得硕士学位的研究生"
                          value="未获得硕士学位的研究生">
                        </el-option>
                        <el-option
                          label="研究生班"
                          value="研究生班">
                        </el-option>
                        <el-option
                          label="双学士学位大学本科（含学制六年以上大学本科）"
                          value="双学士学位大学本科（含学制六年以上大学本科）">
                        </el-option>
                        <el-option
                          label="大学本科"
                          value="大学本科">
                        </el-option>
                        <el-option
                          label="大学专科"
                          value="大学专科">
                        </el-option>
                        <el-option
                          label="高中、中专"
                          value="高中、中专">
                        </el-option>
                        <el-option
                          label="初中"
                          value="初中">
                        </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item prop="startDate" label="入学时间">
                      <el-input v-model="eduForm.startDate" style="width:100px" @change="yearsChange"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                    <el-form-item prop="endDate" label="毕业时间">
                      <el-input v-model="eduForm.endDate" style="width:100px" @change="yearsChange"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                    <el-form-item prop="standardYears" label="学制">
                      <el-select v-model="eduForm.standardYears" @change="yearsChange">
                        <el-option v-for="item in standardYearsOptions" :key="'standardYears_' + item.value" :label="item.label" :value="item.value" />
                      </el-select>
                    </el-form-item>
                    <el-form-item prop="actualYears" label="未计入工龄学龄">
                      <el-select v-model="eduForm.actualYears">
                        <el-option v-for="item in actualYearsOptions" :key="'actualYears_' + item.value" :label="item.label" :value="item.value" />
                      </el-select>
                    </el-form-item>
                    <el-form-item v-if="eduForm.actualYears !== eduForm.calculateYears" prop="yearsDescription" label="说明原因">
                      <el-input v-model="eduForm.yearsDescription" maxlength="100" style="width:80%"></el-input>
                    </el-form-item>
                    <el-form-item>
                      <el-button type="primary" style="margin-bottom:10px;" @click="submitEdu" :loading="saveloading">保存</el-button>
                    </el-form-item>
                  </el-form>
                </el-drawer>
                <div v-if="editForm.state===0||editForm.state===3">
                  <span style="color: red; font-weight: bolder; line-height: 40px;">提示：在校学习的时间以国家规定的学制为依据，如短于国家学制规定，按实际学习年限计算；如长于国家学制规定，按国家规定学制计算</span>
                  <el-button type="primary" style="margin-bottom:10px; float:right;" @click="addedu" icon="el-icon-circle-plus-outline">新增</el-button>
                </div>
                <el-table :data="eduList" highlight-current-row v-loading="listLoading" style="width: 100%;">
                  <el-table-column type="index" label="序号" width="70" fixed align="center" class-name="tableth">
                  </el-table-column>
                  <el-table-column prop="education" label="学历" min-width="400" align="center">
                  </el-table-column>
                  <el-table-column prop="startDate" label="入学时间" min-width="200" align="center">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.startDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="endDate" label="毕业时间" min-width="200" align="center">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.endDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="standardYears" label="学制" min-width="200" align="center">
                    <template slot-scope="scope">
                      {{standardYearsFun(scope.row.standardYears)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="actualYears" label="未计入工龄学龄" min-width="200" align="center">
                    <template slot-scope="scope">
                      {{scope.row.actualYears + '年'}}
                      <el-tooltip v-if="scope.row.yearsDescription" effect="dark" placement="top">
                        <div class="my-tooltip-reason" slot="content">{{ scope.row.yearsDescription }}</div>
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作" width="200" align="center" v-if="editForm.state===0||editForm.state===3" key="eduColumn">
                    <template slot-scope="scope">
                      <el-button @click="editEdu(scope.row)" type="primary" size="mini" style="margin:10px 0 10px 5px">修改</el-button>
                      <el-button @click="removeEdu(scope.row.id)" type="danger" size="mini" style="margin:10px 0 10px 5px" :loading="saveloading">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane name="assess" label="考核信息">
                <el-drawer
                  :title="formTitle"
                  :visible.sync="assessDrawer"
                  direction="rtl"
                  append-to-body
                  >
                  <el-form :model="assessForm" label-width="100px" ref="assessForm" style="padding:10px 0 0;clear:both" inline-message :rules="assessFormRules">
                    <el-form-item prop="theYear" label="考核年度">
                      <el-date-picker v-model="assessForm.theYear" type="year" placeholder="选择年度" format="yyyy" value-format="yyyy"></el-date-picker>
                    </el-form-item>
                    <el-form-item prop="assessLevel" label="考核等级">
                      <el-select v-model="assessForm.assessLevel" style="width:150px">
                        <el-option v-for="(item,index) in assessArr" :key="'access1_'+index" :value="item.value" :label="item.label" />
                      </el-select>
                    </el-form-item>
                    <el-form-item>
                      <el-button type="primary" style="margin-bottom:10px;" @click="submitAssess" :loading="saveloading">保存</el-button>
                    </el-form-item>
                  </el-form>
                </el-drawer>
                <div v-show="(!assessList||assessList.length===0)&&(editForm.state===0||editForm.state===3)">
                  {{editForm.jobDate?editForm.jobDate.slice(0, 4):''}}年到{{nowYear}}年
                  <el-select v-model="assess" style="width:150px">
                    <el-option v-for="(item,index) in assessArr" :key="'access_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                  <el-button type="primary" style="margin-bottom:10px;" @click.native="setAssess" :loading="saveloading" icon="el-icon-circle-plus-outline">批量考核</el-button>
                  <span style="color: red; font-weight: bolder; line-height: 40px;">提示：默认工作第一年为试用期，如有需要可在批量考核操作后手动调整</span>
                </div>
                <div v-show="(assessList&&assessList.length>0)||(editForm.state!==0&&editForm.state!==3)">
                  <span style="color: red; font-weight: bolder; line-height: 40px;">提示：未录入考核年度按未参加工作处理</span>
                  <div style="float:right; margin-bottom:10px;">
                    <el-button type="primary" @click.native="addAssess" icon="el-icon-circle-plus-outline" v-if="editForm.state===0||editForm.state===3">新增</el-button>
                    <el-button type="danger" @click="removeAssess()" :loading="saveloading" icon="el-icon-delete" v-if="editForm.state===0||editForm.state===3">批量删除</el-button>
                  </div>
                  <el-table
                    :data="assessList"
                    highlight-current-row
                    v-loading="listLoading"
                    style="width: 100%;"
                    @selection-change="handleSelectionChange"
                    >
                    <el-table-column v-if="editForm.state===0||editForm.state===3" fixed type="selection" width="50" align="center" class-name="tableth">
                    </el-table-column>
                    <el-table-column type="index" label="序号" width="70" fixed align="center" class-name="tableth">
                    </el-table-column>
                    <el-table-column prop="theYear" label="考核年度" width="250" align="center" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="assessLevel" label="考核等级" width="250" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        <span v-if="scope.row.assessLevel==='1'||scope.row.assessLevel==='2'||scope.row.assessLevel==='22'" style="color:green;font-weight:bolder">{{assessArr.find(item=>item.value===parseInt(scope.row.assessLevel)).label}}</span>
                        <span v-else style="color:red;font-weight:bolder">{{assessArr.find(item=>item.value===parseInt(scope.row.assessLevel)).label}}</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="files" label="附件" min-width="250" header-align="center">
                      <template slot-scope="scope">
                        <!-- <div v-if="canEdit&&(scope.row.state===5||scope.row.state===0)"> -->
                        <div v-if="editForm.state===0||editForm.state===3">
                          <el-upload
                            style="width:800px;margin-bottom:10px;"
                            ref="upload"
                            :action="$http.defaults.baseURL+$http.defaults.salaryAPI +'api/salaryGenFileInfo/upload'"
                            :on-success="function (res, file) { return handleUploadSucc1(res, file, scope.row.id)}"
                            :on-error="uploadError"
                            :before-upload="beforeUpload"
                            accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps"
                            :show-file-list="false"
                          >
                            <el-button type="primary" size="small" :loading="saveloading">上传</el-button>
                          </el-upload>
                        </div>
                        <template v-if="scope.row.files&&scope.row.files.length>0">
                          <div v-for="(item,index) in scope.row.files" :key="index" style="line-height:40px;">
                            <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
                            <el-button v-if="editForm.state===0||editForm.state===3" :loading="listLoading" style="margin-left:10px" size="mini" type="danger" @click="beforeRemove2(item)">删除</el-button>
                          </div>
                        </template>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="200" align="center" v-if="editForm.state===0||editForm.state===3">
                      <template slot-scope="scope">
                        <el-button @click="editAssess(scope.row)" type="primary" size="mini" style="margin:10px 0 10px 5px">修改</el-button>
                        <el-button @click="removeAssess(scope.row.id)" type="danger" size="mini" style="margin:10px 0 10px 5px" :loading="saveloading">删除</el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </el-tab-pane>
              <el-tab-pane name="job" label="履历（用于测算变动后薪级理论值）">
                <el-drawer
                  :title="formTitle"
                  :visible.sync="jobDrawer"
                  direction="rtl"
                  append-to-body
                  >
                  <el-form :model="jobForm" label-width="150px" ref="jobForm" style="padding:10px 0 0;clear:both" inline-message :rules="jobFormRules">
                    <el-form-item prop="jobDate" label="任职起始时间">
                      <el-input v-model="jobForm.jobDate" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                    <el-form-item prop="jobDateEnd" label="任职终止时间">
                      <el-input v-model="jobForm.jobDateEnd" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                    <el-form-item prop="jobStatus" label="任职情况">
                      <el-input v-model="jobForm.jobStatus" maxlength="100" style="width:80%"></el-input>
                    </el-form-item>
                    <el-form-item prop="jobName" label="岗位类型">
                      <el-select v-model="jobForm.jobName" style="width:150px" clearable @change="selectChange1()">
                        <el-option value="专业技术岗位" label="专业技术岗位" />
                        <el-option value="管理岗位" label="管理岗位" />
                        <el-option value="企业" label="企业" />
                        <el-option value="公务员" label="公务员" />
                        <el-option value="待业" label="待业" />
                        <el-option value="上学" label="上学" />
                      </el-select>
                    </el-form-item>
                    <el-form-item prop="jobLevel" label="岗位等级">
                      <el-select v-model="jobForm.jobLevel" style="width:150px" clearable :disabled="jobLevelDisabled">
                        <el-option value="一级" label="一级" />
                        <el-option value="二级" label="二级" />
                        <el-option value="三级" label="三级" />
                        <el-option value="四级" label="四级" />
                        <el-option value="五级" label="五级" />
                        <el-option value="六级" label="六级" />
                        <el-option value="七级" label="七级" />
                        <el-option value="八级" label="八级" />
                        <el-option value="九级" label="九级" />
                        <el-option value="十级" label="十级" />
                        <el-option v-if="jobForm.jobName === '专业技术岗位'" value="十一级" label="十一级" />
                        <el-option v-if="jobForm.jobName === '专业技术岗位'" value="十二级" label="十二级" />
                        <el-option v-if="jobForm.jobName === '专业技术岗位'" value="十三级" label="十三级" />
                        <el-option value="试用期" label="试用期" />
                        <el-option value="不计算调级" label="不计算调级" />
                      </el-select>
                    </el-form-item>
                    <el-form-item v-if="isShowCompare" prop="jobDate2" label="比照任职起始时间">
                      <el-input v-model="jobForm.jobDate2" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                    <el-form-item v-if="isShowCompare" prop="jobDateEnd2" label="比照任职终止时间">
                      <el-input v-model="jobForm.jobDateEnd2" style="width:100px"></el-input>
                      <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </el-form-item>
                    <el-form-item v-if="isShowCompare" prop="jobName2" label="比照岗位类型">
                      <el-select v-model="jobForm.jobName2" style="width:150px" clearable @change="selectChange2()">
                        <el-option value="专业技术岗位" label="专业技术岗位" />
                        <el-option value="管理岗位" label="管理岗位" />
                        <el-option value="不参与计算" label="不参与计算" />
                      </el-select>
                      <span style="font-size: 14px; color: red; font-weight: bolder;">上学、待业等期间请选择不参与计算</span>
                    </el-form-item>
                    <el-form-item v-if="isShowCompare" prop="jobLevel2" label="比照岗位等级">
                      <el-select v-model="jobForm.jobLevel2" style="width:150px" clearable :disabled="jobLevelDisabled2">
                        <el-option value="一级" label="一级" />
                        <el-option value="二级" label="二级" />
                        <el-option value="三级" label="三级" />
                        <el-option value="四级" label="四级" />
                        <el-option value="五级" label="五级" />
                        <el-option value="六级" label="六级" />
                        <el-option value="七级" label="七级" />
                        <el-option value="八级" label="八级" />
                        <el-option value="九级" label="九级" />
                        <el-option value="十级" label="十级" />
                        <el-option v-if="jobForm.jobName2 === '专业技术岗位'" value="十一级" label="十一级" />
                        <el-option v-if="jobForm.jobName2 === '专业技术岗位'" value="十二级" label="十二级" />
                        <el-option v-if="jobForm.jobName2 === '专业技术岗位'" value="十三级" label="十三级" />
                        <el-option value="试用期" label="试用期" />
                      </el-select>
                    </el-form-item>
                    <el-form-item>
                      <el-button type="primary" style="margin-bottom:10px;" @click="submitJob()" :loading="saveloading">保存</el-button>
                    </el-form-item>
                  </el-form>
                </el-drawer>
                <div v-if="editForm.state===0||editForm.state===3">
                  <div style="color: red; font-weight: bolder; line-height: 25px;float:left">提示：履历表包含学历信息和待业信息，时间填写连续完整，不允许出现断档；试用期单独录入；<br>岗位类型不全为专业技术岗位或不全为管理岗位，请勾选“是否比照同等人员”，填写比照信息，勾选后全部按照比照信息计算</div>
                  <el-button type="danger" style="margin-bottom:10px; margin-left: 10px; float:right;" @click="removeJob('', 'after')" :loading="saveloading" icon="el-icon-delete">批量删除</el-button>
                  <el-button type="primary" style="margin-bottom:10px; float:right;" @click="addJob('after')" icon="el-icon-circle-plus-outline">新增</el-button>
                  <el-checkbox v-model="editForm.compareFlag" style="float:right; line-height: 40px; margin-left: 10px;" @change="(val) => compareFlagChange(val, 'after')">是否比照同等人员</el-checkbox>
                  <el-button v-if="editForm.compareFlag" type="success" style="margin-bottom:10px; float:right;" @click="jobSelect('after')">批量初始化选中记录比照信息</el-button>
                </div>
                <el-table
                  ref="multipleTable"
                  :data="jobList"
                  highlight-current-row
                  v-loading="listLoading"
                  style="width: 100%;"
                  border
                  @selection-change="handleSelectionChange"
                 >
                  <el-table-column v-if="editForm.state===0||editForm.state===3" fixed type="selection" width="50" align="center" class-name="tableth" key="selection">
                  </el-table-column>
                  <el-table-column type="index" label="序号" fixed width="70" align="center" class-name="tableth" key="index">
                  </el-table-column>
                  <el-table-column prop="jobDate" label="任职起始时间" width="150" align="center" show-overflow-tooltip key="jobDate">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="jobDateEnd" label="任职终止时间" width="150" align="center" show-overflow-tooltip key="jobDateEnd">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDateEnd)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="jobStatus" label="任职情况" min-width="150" align="center" key="jobStatus">
                    <template slot-scope="scope">
                      <div style="text-align: left;">{{ scope.row.jobStatus }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="jobName" label="岗位类型" width="150" align="center" show-overflow-tooltip key="jobName">
                  </el-table-column>
                  <el-table-column prop="jobLevel" label="岗位等级" width="150" align="center" show-overflow-tooltip key="jobLevel">
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag" prop="jobDate2" label="比照任职起始时间" width="150" align="center" show-overflow-tooltip key="jobDate2">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate2)}}
                    </template>
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag" prop="jobDateEnd2" label="比照任职终止时间" width="150" align="center" show-overflow-tooltip key="jobDateEnd2">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDateEnd2)}}
                    </template>
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag" prop="jobName2" label="比照岗位类型" width="150" align="center" show-overflow-tooltip key="jobName2">
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag" prop="jobLevel2" label="比照岗位等级" width="150" align="center" show-overflow-tooltip key="jobLevel2">
                  </el-table-column>
                  <el-table-column label="操作" width="200" align="center" v-if="editForm.state===0||editForm.state===3">
                    <template slot-scope="scope">
                      <el-button @click="editJob(scope.row, 'after')" type="primary" size="mini" style="margin:10px 0 10px 5px">修改</el-button>
                      <el-button @click="removeJob(scope.row.id, 'after')" type="danger" size="mini" style="margin:10px 0 10px 5px" :loading="saveloading">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane name="salary" label="职级工资（变动后）">
                <h2>2006年职级工资套改情况</h2>
                <el-table :data="listAdjust" highlight-current-row v-loading="listLoading" style="width: 100%;">
                  <el-table-column prop="jobDate" label="参加工作时间" width="150" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="educationYears" label="未记工龄学龄" width="150" align="center" show-overflow-tooltip>
                  </el-table-column>
                  <el-table-column prop="years" label="套改年限" width="100" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{scope.row.years + scope.row.educationYears}}
                    </template>
                  </el-table-column>
                  <el-table-column label="前任低一岗位" align="center">
                    <el-table-column prop="post1" label="岗位" min-width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{scope.row.postClass1}}{{scope.row.post1}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postDate1" label="任职时间" width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{formatDate(scope.row.postDate1)}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postYears1" label="任职年限" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="level1" label="套改薪级" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column label="现任岗位" align="center">
                    <el-table-column prop="post2" label="岗位" min-width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{scope.row.postClass2}}{{scope.row.post2}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postDate2" label="任职时间" width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{formatDate(scope.row.postDate2)}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postYears2" label="任职年限" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="level2" label="套改薪级" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column prop="level" label="套改薪级" width="100" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{scope.row.level}}
                      <el-tooltip v-if="scope.row.level!==scope.row.level2" effect="dark" placement="top">
                        <div v-if="scope.row.level===scope.row.level1" class="my-tooltip-reason" slot="content">工作人员按现聘岗位套改的薪级工资，如低于按本人低一级岗位套改的薪级工资，可按低一级岗位薪级工资进行套改，并将现聘岗位的任职年限与低一级岗位的任职年限合并计算</div>
                        <div v-if="scope.row.level!==scope.row.level1" class="my-tooltip-reason" slot="content">工作人员按套改办法确定的薪级工资，低于相同学历新参加工作人员转正定级薪级工资的，执行相同学历新参加工作人员转正定级薪级工资标准</div>
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </template>
                  </el-table-column>
                </el-table>
                <h2>2006年后职级工资变动情况</h2>
                <el-table :data="listChange" highlight-current-row v-loading="listLoading" style="width: 100%;">
                  <el-table-column prop="jobDate" label="工资变动时间" width="150" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="post" label="岗位等级（岗位变动次月）" width="220" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{scope.row.postClass}}{{scope.row.post}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="level" label="工资薪级" width="100" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <b :style="scope.row.reasonType==='1'?'color:green':''">{{scope.row.level}}</b>
                    </template>
                  </el-table-column>
                  <el-table-column prop="reason" label="变动原因" width="500" header-align="center">
                    <template slot-scope="scope">
                      <b :style="scope.row.reasonType==='1'?'color:green':''">{{scope.row.reason}}</b>
                    </template>
                  </el-table-column>
                    <el-table-column prop="files" label="附件" min-width="300" header-align="center">
                      <template slot-scope="scope">
                        <!-- <div v-if="canEdit&&(scope.row.state===5||scope.row.state===0)"> -->
                        <div v-if="editForm.state===0||editForm.state===3">
                          <el-upload
                            style="width:800px;margin-bottom:10px;"
                            ref="upload"
                            :action="$http.defaults.baseURL+$http.defaults.salaryAPI +'api/salaryGenFileInfo/upload'"
                            :on-success="function (res, file) { return handleUploadSucc2(res, file, scope.row.id)}"
                            :on-error="uploadError"
                            :before-upload="beforeUpload"
                            accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps"
                            :show-file-list="false"
                          >
                            <el-button type="primary" size="small" :loading="saveloading">上传</el-button>
                          </el-upload>
                        </div>
                        <template v-if="scope.row.files&&scope.row.files.length>0">
                          <div v-for="(item,index) in scope.row.files" :key="index" style="line-height:40px">
                            <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
                            <el-button v-if="editForm.state===0||editForm.state===3" :loading="listLoading" style="margin-left:10px" size="mini" type="danger" @click="beforeRemove3(item, 'after')">删除</el-button>
                          </div>
                        </template>
                      </template>
                    </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane v-if="isShowChangeBefore" name="job2" label="履历（用于测算变动前薪级理论值）">
                <div v-if="editForm.state===0||editForm.state===3">
                  <div style="color: red; font-weight: bolder; line-height: 25px;float:left">提示：履历表包含学历信息和待业信息，时间填写连续完整，不允许出现断档；试用期单独录入；<br>岗位类型不全为专业技术岗位或不全为管理岗位，请勾选“是否比照同等人员”，填写比照信息，勾选后全部按照比照信息计算</div>
                  <el-button type="danger" style="margin-bottom:10px; margin-left: 8px; float:right;" @click="removeJob('', 'before')" :loading="saveloading" icon="el-icon-delete">批量删除</el-button>
                  <el-button type="primary" style="margin-bottom:10px; float:right;" @click="addJob('before')" icon="el-icon-circle-plus-outline">新增</el-button>
                  <el-checkbox v-model="editForm.compareFlag2" style="float:right; line-height: 40px; margin-left: 8px;" @change="(val) => compareFlagChange(val, 'before')">是否比照同等人员</el-checkbox>
                  <el-button v-if="editForm.compareFlag2" type="success" style="margin-bottom:10px; float:right; margin-left: 8px;" @click="jobSelect('before')">批量初始化选中记录比照信息</el-button>
                  <el-button v-if="jobList2.length===0" type="primary" style="margin-bottom:10px; float:right;" :loading="btnLoading" @click="copyJobInfo()">复制履历（用于测算变动后薪级理论值）信息</el-button>
                </div>
                <el-table
                  ref="multipleTable2"
                  :data="jobList2"
                  highlight-current-row
                  v-loading="listLoading"
                  style="width: 100%;"
                  border
                  @selection-change="handleSelectionChange"
                 >
                  <el-table-column v-if="editForm.state===0||editForm.state===3" fixed type="selection" width="50" align="center" class-name="tableth" key="selection2">
                  </el-table-column>
                  <el-table-column type="index" label="序号" fixed width="70" align="center" class-name="tableth" key="index2">
                  </el-table-column>
                  <el-table-column prop="jobDate" label="任职起始时间" width="150" align="center" show-overflow-tooltip key="jobDate2">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="jobDateEnd" label="任职终止时间" width="150" align="center" show-overflow-tooltip key="jobDateEnd2">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDateEnd)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="jobStatus" label="任职情况" min-width="150" align="center" key="jobStatus2">
                    <template slot-scope="scope">
                      <div style="text-align: left;">{{ scope.row.jobStatus }}</div>
                    </template>
                  </el-table-column>
                  <el-table-column prop="jobName" label="岗位类型" width="150" align="center" show-overflow-tooltip key="jobName2">
                  </el-table-column>
                  <el-table-column prop="jobLevel" label="岗位等级" width="150" align="center" show-overflow-tooltip key="jobLevel2">
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag2" prop="jobDate2" label="比照任职起始时间" width="150" align="center" show-overflow-tooltip key="jobDate22">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate2)}}
                    </template>
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag2" prop="jobDateEnd2" label="比照任职终止时间" width="150" align="center" show-overflow-tooltip key="jobDateEnd22">
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDateEnd2)}}
                    </template>
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag2" prop="jobName2" label="比照岗位类型" width="150" align="center" show-overflow-tooltip key="jobName22">
                  </el-table-column>
                  <el-table-column v-if="editForm.compareFlag2" prop="jobLevel2" label="比照岗位等级" width="150" align="center" show-overflow-tooltip key="jobLevel22">
                  </el-table-column>
                  <el-table-column label="操作" width="200" align="center" v-if="editForm.state===0||editForm.state===3">
                    <template slot-scope="scope">
                      <el-button @click="editJob(scope.row, 'before')" type="primary" size="mini" style="margin:10px 0 10px 5px">修改</el-button>
                      <el-button @click="removeJob(scope.row.id, 'before')" type="danger" size="mini" style="margin:10px 0 10px 5px" :loading="saveloading">删除</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-tab-pane>
              <el-tab-pane v-if="isShowChangeBefore" name="salary2" label="职级工资（变动前）">
                <h2>2006年职级工资套改情况</h2>
                <el-table :data="listAdjust2" highlight-current-row v-loading="listLoading" style="width: 100%;">
                  <el-table-column prop="jobDate" label="参加工作时间" width="150" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="educationYears" label="未记工龄学龄" width="150" align="center" show-overflow-tooltip>
                  </el-table-column>
                  <el-table-column prop="years" label="套改年限" width="100" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{scope.row.years + scope.row.educationYears}}
                    </template>
                  </el-table-column>
                  <el-table-column label="前任低一岗位" align="center">
                    <el-table-column prop="post1" label="岗位" min-width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{scope.row.postClass1}}{{scope.row.post1}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postDate1" label="任职时间" width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{formatDate(scope.row.postDate1)}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postYears1" label="任职年限" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="level1" label="套改薪级" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column label="现任岗位" align="center">
                    <el-table-column prop="post2" label="岗位" min-width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{scope.row.postClass2}}{{scope.row.post2}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postDate2" label="任职时间" width="100" align="center" show-overflow-tooltip>
                      <template slot-scope="scope">
                        {{formatDate(scope.row.postDate2)}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="postYears2" label="任职年限" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                    <el-table-column prop="level2" label="套改薪级" width="100" align="center" show-overflow-tooltip>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column prop="level" label="套改薪级" width="100" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{scope.row.level}}
                      <el-tooltip v-if="scope.row.level!==scope.row.level2" effect="dark" placement="top">
                        <div v-if="scope.row.level===scope.row.level1" class="my-tooltip-reason" slot="content">工作人员按现聘岗位套改的薪级工资，如低于按本人低一级岗位套改的薪级工资，可按低一级岗位薪级工资进行套改，并将现聘岗位的任职年限与低一级岗位的任职年限合并计算</div>
                        <div v-if="scope.row.level!==scope.row.level1" class="my-tooltip-reason" slot="content">工作人员按套改办法确定的薪级工资，低于相同学历新参加工作人员转正定级薪级工资的，执行相同学历新参加工作人员转正定级薪级工资标准</div>
                        <el-button type="text" icon="el-icon-info" />
                      </el-tooltip>
                    </template>
                  </el-table-column>
                </el-table>
                <h2>2006年后职级工资变动情况</h2>
                <el-table :data="listChange2" highlight-current-row v-loading="listLoading" style="width: 100%;">
                  <el-table-column prop="jobDate" label="工资变动时间" width="150" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{formatDate(scope.row.jobDate)}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="post" label="岗位等级（岗位变动次月）" width="220" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      {{scope.row.postClass}}{{scope.row.post}}
                    </template>
                  </el-table-column>
                  <el-table-column prop="level" label="工资薪级" width="100" align="center" show-overflow-tooltip>
                    <template slot-scope="scope">
                      <b :style="scope.row.reasonType==='1'?'color:green':''">{{scope.row.level}}</b>
                    </template>
                  </el-table-column>
                  <el-table-column prop="reason" label="变动原因" width="500" header-align="center">
                    <template slot-scope="scope">
                      <b :style="scope.row.reasonType==='1'?'color:green':''">{{scope.row.reason}}</b>
                    </template>
                  </el-table-column>
                    <el-table-column prop="files" label="附件" min-width="300" header-align="center">
                      <template slot-scope="scope">
                        <!-- <div v-if="canEdit&&(scope.row.state===5||scope.row.state===0)"> -->
                        <div v-if="editForm.state===0||editForm.state===3">
                          <el-upload
                            style="width:800px;margin-bottom:10px;"
                            ref="upload"
                            :action="$http.defaults.baseURL+$http.defaults.salaryAPI +'api/salaryGenFileInfo/upload'"
                            :on-success="function (res, file) { return handleUploadSucc3(res, file, scope.row.id)}"
                            :on-error="uploadError"
                            :before-upload="beforeUpload"
                            accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps"
                            :show-file-list="false"
                          >
                            <el-button type="primary" size="small" :loading="saveloading">上传</el-button>
                          </el-upload>
                        </div>
                        <template v-if="scope.row.files&&scope.row.files.length>0">
                          <div v-for="(item,index) in scope.row.files" :key="index" style="line-height:40px">
                            <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
                            <el-button v-if="editForm.state===0||editForm.state===3" :loading="listLoading" style="margin-left:10px" size="mini" type="danger" @click="beforeRemove3(item, 'before')">删除</el-button>
                          </div>
                        </template>
                      </template>
                    </el-table-column>
                </el-table>
              </el-tab-pane>
            </el-tabs>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  watch: {
    timestamp: {
      handler (val) {
        // this.$refs['editForm'].resetFields()
        this.editFormReset()
        this.init()
        if (this.readOnly) {
          this.formType = 'detail'
        } else {
          this.formType = 'edit'
        }
      },
      immediate: true
    }
  },
  props: {
    addType: '',
    state: '', // state===2从已完成列表点击编辑
    Formal: false,
    showDept: true,
    personId: '',
    approvalId: '',
    readOnly: '',
    timestamp: '',
    passStep: '',
    unitId: ''
  },
  data () {
    return {
      exportLoading: false,
      postArr: [
        {label: '管理岗位', value: '管理岗位', type: 1},
        {label: '专业技术岗位', value: '专业技术岗位', type: 1},
        {label: '公务员', value: '公务员', type: 2},
        {label: '企业', value: '企业', type: 2},
        {label: '军转', value: '军转', type: 2}
      ],
      standardList: [],
      btnLoading: false,
      listAdjust: [],
      listAdjust2: [],
      listChange: [],
      listChange2: [],
      bz: '',
      formTitle: '新增',
      nowYear: null,
      assessList: [],
      assessDrawer: false,
      assessForm: {
        assesscation: '',
        startDate: '',
        endDate: ''
      },
      assessFormRules: {
        theYear: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        assessLevel: [
          { required: true, message: '必填项', trigger: 'change' }
        ]
      },
      jobList: [],
      jobList2: [],
      jobDrawer: false,
      jobForm: {
        jobDate: '',
        jobDateEnd: '',
        jobStatus: '',
        jobName: '',
        jobLevel: '',
        jobDate2: '',
        jobDateEnd2: '',
        jobName2: '',
        jobLevel2: ''
      },
      jobFormRules: {
        jobDate: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobDateEnd: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobName: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobStatus: [
          { required: true, message: '必填项', trigger: 'change' }
        ]
      },
      eduList: [],
      eduDrawer: false,
      eduForm: {
        education: '',
        startDate: '',
        endDate: '',
        standardYears: '',
        actualYears: '',
        yearsDescription: '',
        calculateYears: ''
      },
      eduFormRules: {
        education: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        startDate: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        endDate: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        standardYears: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        actualYears: [
          { required: true, message: '必填项', trigger: 'change' }
        ]
      },
      formType: 'detail',
      reasonList: [
        {
          label: '审批',
          options: [{
            value: 11,
            label: '新提任副局级干部'
          }, {
            value: 12,
            label: '现任局级干部变更工资序列'
          }, {
            value: 13,
            label: '现任局级干部从企业或原执行公务员工资序列单位调入部直属事业单位'
          }]
        }, {
          label: '备案',
          options: [{
            value: 21,
            label: '局级干部年度晋升工资薪级'
          }, {
            value: 22,
            label: '因享受劳模待遇高定工资薪级'
          }, {
            value: 23,
            label: '因受处分、被采取强制措施或受行政、刑事处罚需要低定工资'
          }, {
            value: 24,
            label: '因岗位等级晋升需要晋升基本工资'
          }, {
            value: 25,
            label: '基本工资标准调整'
          }, {
            value: 26,
            label: '专技岗位变动'
          }, {
            value: 27,
            label: '其他'
          }]
        }
      ],
      listLoading: false,
      accessState: 0,
      activeName: 'personInfo',
      activeName2: 'education',
      assess: '',
      assessArr: [
        {label: '优秀', value: 1},
        {label: '称职', value: 2},
        {label: '基本称职', value: 3},
        {label: '不称职', value: 4},
        {label: '未定考核等级', value: 5},
        {label: '合格', value: 22},
        {label: '基本合格', value: 23},
        {label: '不合格', value: 24},
        {label: '考核不定等次', value: 25},
        {label: '不计入工龄', value: 6},
        {label: '试用期', value: 7},
        {label: '未参加工作', value: 30}
      ],
      sexList: [
        {label: '男', value: 1},
        {label: '女', value: 2}
      ],
      educationList: ['大专', '本科生', '硕士研究生', '博士研究生', '其他'],
      list4: [
        {
          id: 1,
          jobDate: '2005.01',
          eduYears: 2,
          years: 1,
          post1: '六级职员',
          post2: '五级职员',
          postDate1: '2005.01',
          postDate2: '2006.01',
          postYears1: 1,
          postYears2: 1,
          level1: 24,
          level2: 25,
          level: 25
        }
      ],
      list5: [
        {
          id: 1,
          date: '2007.01',
          post: '五级职员',
          level: 25,
          reason: '',
          files: [{id: 1, name: '附件1.pdf'}]
        }, {
          id: 1,
          date: '2008.01',
          post: '五级职员',
          level: 26,
          reason: '',
          files: [{id: 1, name: '附件1.pdf'}]
        }, {
          id: 1,
          date: '2009.01',
          post: '五级职员',
          level: 27,
          reason: '',
          files: [{id: 1, name: '附件1.pdf'}]
        }, {
          id: 1,
          date: '2009.11',
          post: '四级职员',
          level: 27,
          reason: '职务晋升',
          files: [{id: 1, name: '附件1.pdf'}]
        }
      ],
      showMore: false,
      passed: null,
      importPhotoFlag: false,
      imageUrl: '',
      editForm: {
        id: null,
        theYear: '',
        realname: '',
        realName: '',
        idCardNo: '',
        gender: '',
        birthday: '',
        education: '',
        jobDate: '',
        currentJobDate: '',
        unitName: '',
        reason: '',
        standard1: '',
        standard2: '',
        jobClass1: '',
        jobClass2: '',
        jobLevel1: '',
        jobLevel2: '',
        jobSalary1: '',
        jobSalary2: '',
        jobSalary3: '',
        salaryLevel1: '',
        salaryLevel2: '',
        salaryLevel3: '',
        levelSalary1: '',
        levelSalary2: '',
        levelSalary3: '',
        salary1: '',
        salary2: '',
        salary3: '',
        salaryDate: '',
        remarks: '',
        description: '',
        files: [],
        files2: [],
        compareFlag: false,
        description2: ''
      },
      showlog: false,
      passed0: null,
      readed: false,
      files: [],
      fileList: [],
      pageLoading: false,
      editFormRules: {
        theYear: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        realname: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        realName: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        idCardNo: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        gender: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        birthday: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        education: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobDate: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        currentJobDate: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        unitName: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        reason: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        standard1: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        standard2: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobClass1: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobClass2: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobLevel1: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        // jobLevel2: [
        //   { required: true, message: '必填项', trigger: 'change' }
        // ],
        salaryLevel1: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        salaryLevel2: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        salaryDate: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        jobSalary1: [
          { required: true, message: '必填项', trigger: 'change' }
        ],
        levelSalary1: [
          { required: true, message: '必填项', trigger: 'change' }
        ]
      },
      zzmmoptions: [],
      xboptions: [],
      mzoptions: [],
      dwoptions: [],
      shfloptions: [],
      lyfloptions: [],
      pysyjylxoptions: [],
      saveloading: false,
      userRoles: '',
      unitname: '',
      opinionFlag: false,
      oldunit: 0,
      standardDetail: '',
      jobLevelList1: [],
      jobLevelList2: [],
      salaryLevelList1: [],
      salaryLevelList2: [],
      fileList4: [],
      jobLevelDisabled: false,
      jobLevelDisabled2: false,
      multipleSelection: [],
      standardYearsOptions: [
        {label: '1年', value: 1},
        {label: '2年', value: 2},
        {label: '3年', value: 3},
        {label: '4年', value: 4},
        {label: '5年', value: 5},
        {label: '6年', value: 6},
        {label: '7年', value: 7},
        {label: '8年', value: 8},
        {label: '一年半', value: 1.5},
        {label: '二年半', value: 2.5},
        {label: '三年半', value: 3.5},
        {label: '四年半', value: 4.5}
      ],
      actualYearsOptions: [
        {label: '0年', value: 0},
        {label: '1年', value: 1},
        {label: '2年', value: 2},
        {label: '3年', value: 3},
        {label: '4年', value: 4},
        {label: '5年', value: 5},
        {label: '6年', value: 6},
        {label: '7年', value: 7},
        {label: '8年', value: 8}
      ],
      isShowChangeBefore: false,
      isShowCompare: false,
      compareBeforeOrAfter: ''
    }
  },
  methods: {
    // 监听身份证号的变化
    idCardNoChange () {
      if (this.editForm.idCardNo.includes('x')) {
        this.editForm.idCardNo = this.editForm.idCardNo.replace('x', 'X')
      }
    },
    // 学制翻译
    standardYearsFun (value) {
      const arr = this.standardYearsOptions.filter(item => item.value === value)
      if (arr.length > 0) {
        return arr[0].label
      }
    },
    // 计算学历年限
    yearsChange () {
      if (this.eduForm.startDate && this.eduForm.endDate && this.eduForm.standardYears) {
        if (this.eduForm.startDate.length >= 4 && this.eduForm.endDate.length >= 4) {
          const startYear = parseInt(this.eduForm.startDate.slice(0, 4))
          const endYear = parseInt(this.eduForm.endDate.slice(0, 4))
          const year = endYear - startYear
          if (year <= this.eduForm.standardYears) {
            this.eduForm.actualYears = year < 1 ? 1 : year
            this.eduForm.calculateYears = year < 1 ? 1 : year
          } else {
            this.eduForm.actualYears = this.$set(this.eduForm, 'actualYears', Math.round(this.eduForm.standardYears) < 1 ? 1 : Math.round(this.eduForm.standardYears))
            this.eduForm.calculateYears = this.$set(this.eduForm, 'calculateYears', Math.round(this.eduForm.standardYears) < 1 ? 1 : Math.round(this.eduForm.standardYears))
          }
        }
      }
    },
    // 履历 批量初始化
    handleSelectionChange (val) {
      this.multipleSelection = val.map(item => item.id)
    },
    jobSelect (flag) {
      if (this.multipleSelection.length > 0) {
        const para = {
          ids: [...this.multipleSelection]
        }
        this.listLoading = true
        let url = ''
        url = flag === 'after' ? 'api/salaryBusJob/updateBatchFields' : 'api/salaryBusJob2/updateBatchFields'
        this.$http
          .post(this.$http.defaults.salaryAPI + url, para)
          .then(response => {
            if (response.data.success) {
              this.$message({
                message: '操作成功',
                type: 'success'
              })
              flag === 'after' ? this.getJobList() : this.getJobList2()
            } else {
              this.$message({
                message: '操作失败:' + response.data.message,
                type: 'error'
              })
            }
          })
          .catch(error => {
            console.log(error)
            this.$message({
              message: '操作失败:' + error,
              type: 'error'
            })
          })
      } else {
        this.$message({
          message: '至少选择一条信息',
          type: 'info'
        })
      }
    },
    // 是否比照同等人员
    compareFlagChange (val, flag) {
      const para = {
        id: this.editForm.id
      }
      flag === 'after' ? para.compareFlag = val ? 1 : 0 : para.compareFlag2 = val ? 1 : 0
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/save', para)
        .then(response => {
          if (response.data.success) {
            flag === 'after' ? this.getJobList() : this.getJobList2()
          } else {
            this.$message({
              message: '操作失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '操作失败:' + error,
            type: 'error'
          })
        })
    },
    // 任职发文
    uploadOfficeDocument () {
      if (!this.fileList4 || this.fileList4.length === 0) {
        // 触发上传
        this.$refs['uploadOfficeDocumentRef'].$refs['upload-inner'].handleClick()
      } else {
        this.$confirm('任职发文只能传一个文件，目前已经上传过，是否需要替换', '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning'
        }).then(() => {
          this.$refs['uploadOfficeDocumentRef'].$refs['upload-inner'].handleClick()
        })
      }
    },
    handleUploadSucc4 (response, file, fileList) {
      console.log(response)
      this.saveloading = false
      if (response.success) {
        const obj = response.result[0]
        this.fileList4 = []
        this.fileList4.push({
          id: obj.id,
          name: obj.fileName + '.' + obj.fileType
        })
        this.$message({
          message: '上传成功！' + response.message,
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    handleRemove4 () {
      this.fileList4 = []
    },
    // 根据任职时间计算执行时间
    currentJobDateBlur (e) {
      if (!this.editForm.salaryDate) {
        if (e.target.value.length >= 6) {
          const date = e.target.value.slice(0, 6)
          let year = parseInt(date.slice(0, 4))
          let month = parseInt(date.slice(4, 6))
          if (month >= 1 && month <= 8) {
            month += 1
            this.$set(this.editForm, 'salaryDate', year + '0' + month)
          } else if (month >= 9 && month <= 11) {
            month += 1
            month += ''
            this.$set(this.editForm, 'salaryDate', year + month)
          } else if (month === 12) {
            year += 1
            month = '01'
            this.$set(this.editForm, 'salaryDate', year + month)
          }
        }
      }
    },
    // 监听年度变化 获取最近一条申请表记录
    yearChange (newVal) {
      const para = {
        personId: this.editForm.personId,
        theYear: newVal
      }
      if (newVal) {
        this.$http
          .post(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/getPersonLastRecord', para)
          .then(response => {
            if (response.data.success) {
              if (response.data.result.standard2) {
                this.$set(this.editForm, 'standard1', response.data.result.standard2)
              }
              if (response.data.result.jobClass2) {
                this.$set(this.editForm, 'jobClass1', response.data.result.jobClass2)
              }
              if (response.data.result.jobLevel2) {
                this.$set(this.editForm, 'jobLevel1', response.data.result.jobLevel2)
              }
              if (response.data.result.salaryLevel2) {
                this.$set(this.editForm, 'salaryLevel1', response.data.result.salaryLevel2 + '')
              }
              if (this.editForm.jobClass1 && this.editForm.standard1) {
                this.filterFun1()
              }
              if (this.editForm.jobClass1 && this.editForm.standard1 && this.editForm.jobLevel1 && this.editForm.salaryLevel1) {
                this.salaryLevelChange1()
              }
              if (response.data.result.education) {
                this.$set(this.editForm, 'education', response.data.result.education)
              }
              if (response.data.result.jobDate) {
                this.$set(this.editForm, 'jobDate', response.data.result.jobDate)
              }
              if (response.data.result.unitName) {
                this.$set(this.editForm, 'unitName', response.data.result.unitName)
              }
            } else {
              if (response.data.message !== '发生错误：没有找到最近一条申请记录') {
                this.$message({
                  message: '获取失败:' + response.data.message,
                  type: 'error'
                })
              }
            }
          })
          .catch(error => {
            console.log(error)
            this.$message({
              message: '获取失败:' + error,
              type: 'error'
            })
          })
      }
    },
    // 复制履历信息
    copyJobInfo () {
      this.$confirm('确认复制履历（用于测算变动后薪级理论值）信息吗?', '提示', {
        type: 'success'
      }).then(() => {
        this.btnLoading = true
        this.$http
          .get(this.$http.defaults.salaryAPI + `api/salaryBusJob2/copyDataFromBusJob?approvalId=${this.approvalId ? this.approvalId : this.editForm.id}`)
          .then(response => {
            this.btnLoading = false
            if (response.data.success) {
              this.editForm.compareFlag2 = this.editForm.compareFlag
              this.getJobList2()
            } else {
              this.$message({
                message: '获取失败:' + response.data.message,
                type: 'error'
              })
            }
          })
          .catch(error => {
            this.$message({
              message: '网络获取失败:' + error,
              type: 'error'
            })
            this.btnLoading = false
          })
      })
    },
    getPersonInfo () {
      this.saveloading = true
      this.$http
        .get(this.$http.defaults.salaryAPI + 'api/salaryBusPerson/getById?id=' + this.personId)
        .then(response => {
          if (response.data.success) {
            this.editForm.id = response.data.result.id
            this.editForm.realname = response.data.result.realname
            this.editForm.idCardNo = response.data.result.idCardNo
            this.saveloading = false
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
            this.saveloading = false
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
          this.saveloading = false
        })
    },
    selectChange1 () {
      this.$set(this.jobForm, 'jobLevel', '')
      if (this.jobForm.jobName === '企业' || this.jobForm.jobName === '公务员' || this.jobForm.jobName === '待业' || this.jobForm.jobName === '上学') {
        this.jobLevelDisabled = true
      } else {
        this.jobLevelDisabled = false
      }
    },
    selectChange2 () {
      this.$set(this.jobForm, 'jobLevel2', '')
      console.log(this.jobForm.jobName2)
      if (this.jobForm.jobName2 === '不参与计算') {
        this.jobLevelDisabled2 = true
      } else {
        this.jobLevelDisabled2 = false
      }
    },
    download (id) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.salaryAPI + 'api/salaryGenFileInfo/download?id=' + id)
    },
    saveInit () {
      let url = ''
      url = 'api/salaryBusApproval/saveInit'
      this.pageLoading = true
      this.$http
        .get(this.$http.defaults.salaryAPI + url + `?id=` + (this.approvalId ? this.approvalId : this.editForm.id))
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.getEduList()
            this.getJobList()
            this.getAssessList()
            this.getAdjustList()
            this.getChangeList()
            this.getApprovalDetail(this.approvalId ? this.approvalId : this.editForm.id)
          } else {
            this.$message({
              message: '初始化失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络初始化失败:' + error,
            type: 'error'
          })
        })
    },
    // 参照标准翻译
    standardFun (flag) {
      if (flag === 0) {
        return '其他标准'
      } else {
        const result = this.standardList.find(item => item.id === flag)
        if (result) {
          return result.standardType
        } else {
          return ''
        }
      }
    },
    // 导出
    exportApprocal () {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.salaryAPI + 'api/salaryBusApproval/getExport?id=' + this.editForm.id)
    },
    // 导出测算信息
    exportOthers () {
      this.exportLoading = true
      this.$http
        .get(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/canGetAllExport?id=' + this.editForm.id)
        .then(response => {
          this.exportLoading = false
          if (response.data.result) {
            window.open(this.$http.defaults.baseURL + this.$http.defaults.salaryAPI + 'api/salaryBusApproval/getAllExport?id=' + this.editForm.id)
          } else {
            this.$message({
              message: '测算信息不完整，请补充完整后再导出',
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.exportLoading = false
          console.log(error)
          this.$message({
            message: '网络导出失败:' + error,
            type: 'error'
          })
        })
    },
    // 合计
    count1 () {
      if (this.editForm.jobSalary1 && this.editForm.levelSalary1) {
        this.editForm.salary1 = this.editForm.jobSalary1 + this.editForm.levelSalary1
      }
      this.limit1()
      this.count3()
    },
    count2 () {
      if (this.editForm.jobSalary2 && this.editForm.levelSalary2) {
        this.editForm.salary2 = this.editForm.jobSalary2 + this.editForm.levelSalary2
      }
      this.count1()
      this.limit2()
      this.count3()
    },
    count3 () {
      if (this.editForm.jobSalary1 && this.editForm.levelSalary1 && this.editForm.jobSalary2 && this.editForm.levelSalary2) {
        this.editForm.salary3 = this.editForm.jobSalary3 + this.editForm.levelSalary3
      }
    },
    // 增资额
    limit1 () {
      if (this.editForm.jobSalary1 && this.editForm.jobSalary2) {
        this.editForm.jobSalary3 = this.editForm.jobSalary2 - this.editForm.jobSalary1
      }
    },
    limit2 () {
      if (this.editForm.levelSalary1 && this.editForm.levelSalary2) {
        this.editForm.levelSalary3 = this.editForm.levelSalary2 - this.editForm.levelSalary1
      }
    },
    // 获取对应的工资标准
    jobLevelChange1 () {
      if (this.editForm.jobLevel1 === '') {
        this.editForm.jobSalary1 = ''
        this.editForm.jobSalary3 = ''
        this.editForm.salary1 = ''
        this.editForm.salary3 = ''
        return
      }
      if (this.editForm.jobLevel1) {
        if (this.editForm.jobClass1 === '专业技术岗位' || this.editForm.jobClass1 === '管理岗位') {
          this.editForm.jobSalary1 = this.jobLevelList1.find(item => item.level === this.editForm.jobLevel1).salary
        }
        this.count1()
        this.limit1()
        this.limit2()
        this.count3()
      }
    },
    jobLevelChange2 () {
      if (this.editForm.jobLevel2 === '') {
        this.editForm.jobSalary2 = ''
        this.editForm.jobSalary3 = ''
        this.editForm.salary2 = ''
        this.editForm.salary3 = ''
        return
      }
      if (this.editForm.jobLevel2) {
        this.editForm.jobSalary2 = this.jobLevelList2.find(item => item.level === this.editForm.jobLevel2).salary
        this.count2()
        this.limit1()
        this.limit2()
        this.count3()
      }
    },
    salaryLevelChange1 () {
      this.editForm.levelSalary1 = this.salaryLevelList1.find(item => item.level === this.editForm.salaryLevel1).salary
      this.count1()
      this.limit1()
      this.limit2()
      this.count3()
    },
    salaryLevelChange2 () {
      this.editForm.levelSalary2 = this.salaryLevelList2.find(item => item.level === this.editForm.salaryLevel2).salary
      this.count2()
      this.limit1()
      this.limit2()
      this.count3()
    },
    // 根据标准和类别筛选岗位等级和薪级
    filterFun1 () {
      if (this.editForm.jobClass1 === '管理岗位' && (this.editForm.jobLevel1 === '十一级' || this.editForm.jobLevel1 === '十二级' || this.editForm.jobLevel1 === '十三级')) {
        this.editForm.jobLevel1 = ''
      }
      if (this.editForm.jobClass1 && this.editForm.standard1) {
        const result = JSON.parse(localStorage.getItem('standard')).filter(item => item.standardId === this.editForm.standard1).filter(item => item.jobClass === this.editForm.jobClass1)
        this.jobLevelList1 = result.filter(item => item.salaryClass === '岗位工资')
        this.salaryLevelList1 = result.filter(item => item.salaryClass === '薪级工资')
      }
      this.jobLevelChange1()
    },
    filterFun2 () {
      if (this.editForm.jobClass2 === '管理岗位' && (this.editForm.jobLevel2 === '十一级' || this.editForm.jobLevel2 === '十二级' || this.editForm.jobLevel2 === '十三级')) {
        this.editForm.jobLevel2 = ''
      }
      if (this.editForm.jobClass2 && this.editForm.standard2) {
        const result = JSON.parse(localStorage.getItem('standard')).filter(item => item.standardId === this.editForm.standard2).filter(item => item.jobClass === this.editForm.jobClass2)
        this.jobLevelList2 = result.filter(item => item.salaryClass === '岗位工资')
        this.salaryLevelList2 = result.filter(item => item.salaryClass === '薪级工资')
      }
      this.jobLevelChange2()
    },
    // 没有选择岗位等级和薪级时提示
    tooltipFun1 () {
      if (this.editForm.standard1 === 0 || this.editForm.jobClass1 === '公务员' || this.editForm.jobClass1 === '军转' || this.editForm.jobClass1 === '企业') return
      if (!this.editForm.jobClass1 || !this.editForm.standard1) {
        this.$message({
          message: '请先选择参照标准和岗位类别',
          type: 'error'
        })
      }
    },
    tooltipFun2 () {
      if (!this.editForm.jobClass2 || !this.editForm.standard2) {
        this.$message({
          message: '请先选择参照标准和岗位类别',
          type: 'error'
        })
      }
    },
    createChanges () {
      if (this.eduList.length === 0) {
        this.$message({
          message: '请先将学历信息填写完整',
          type: 'error'
        })
        this.activeName2 = 'education'
        return false
      }
      if (this.assessList.length === 0) {
        this.$message({
          message: '请先将考核信息填写完整',
          type: 'error'
        })
        this.activeName2 = 'assess'
        return false
      }
      if (this.jobList.length === 0) {
        this.$message({
          message: '请先将履历填写完整',
          type: 'error'
        })
        this.activeName2 = 'job'
        return false
      }
      if (this.editForm.compareFlag) {
        const arr = this.jobList.filter(item => item.jobDate2 && item.jobDateEnd2 && item.jobName2 && item.jobLevel2)
        if (arr.length < 1) {
          this.$message({
            message: '请填写比照信息',
            type: 'error'
          })
          this.activeName2 = 'job'
          return false
        }
      }
      this.pageLoading = true
      this.activeName2 = 'salary'
      this.$http
        .get(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/saveAdjustById' + '?id=' + (this.approvalId ? this.approvalId : this.editForm.id))
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.getAdjustList()
            this.getChangeList()
            this.getApprovalDetail(this.approvalId ? this.approvalId : this.editForm.id)
          } else {
            this.$message({
              message: '计算失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络计算失败:' + error,
            type: 'error'
          })
        })
    },
    createChanges2 () {
      if (this.eduList.length === 0) {
        this.$message({
          message: '请先将学历信息填写完整',
          type: 'error'
        })
        this.activeName2 = 'education'
        return false
      }
      if (this.assessList.length === 0) {
        this.$message({
          message: '请先将考核信息填写完整',
          type: 'error'
        })
        this.activeName2 = 'assess'
        return false
      }
      if (this.jobList2.length === 0) {
        this.$message({
          message: '请先将履历填写完整',
          type: 'error'
        })
        this.activeName2 = 'job2'
        return false
      }
      if (this.editForm.compareFlag2) {
        const arr = this.jobList2.filter(item => item.jobDate2 && item.jobDateEnd2 && item.jobName2 && item.jobLevel2)
        if (arr.length < 1) {
          this.$message({
            message: '请填写比照信息',
            type: 'error'
          })
          this.activeName2 = 'job2'
          return false
        }
      }
      this.pageLoading = true
      this.activeName2 = 'salary2'
      this.$http
        .get(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/saveAdjustById' + '?id=' + (this.approvalId ? this.approvalId : this.editForm.id) + '&class=2')
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.getAdjustList2()
            this.getChangeList2()
            this.getApprovalDetail(this.approvalId ? this.approvalId : this.editForm.id)
          } else {
            this.$message({
              message: '计算失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络计算失败:' + error,
            type: 'error'
          })
        })
    },
    submitApproval2 () {
      if (!this.passed) {
        this.$message({
          message: '请选择审批结果',
          type: 'error'
        })
        this.saveloading = false
        return false
      }
      if (this.passed === 3 && this.bz === '') {
        this.$message({
          message: '选择退回请说明原因',
          type: 'error'
        })
        return false
      }
      this.saveloading = true
      let para = {
        id: this.editForm.id,
        state: this.passed,
        backReason: this.passed === 3 ? this.bz : '',
        fileIds: (this.editForm.files && this.editForm.files.length > 0) ? this.editForm.files.map(item => item.id) : [],
        fileIds2: (this.editForm.files2 && this.editForm.files2.length > 0) ? this.editForm.files2.map(item => item.id) : []
      }
      this.$http
        .post(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/save', para)
        .then(response => {
          this.saveloading = false
          if (response.data.success) {
            this.$message({
              message: '提交成功',
              type: 'success'
            })
            this.editFormReset()
            this.$emit('dialogHide', true)
          } else {
            this.$message({
              message: '提交失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.saveloading = false
          console.log(error)
          this.$message({
            message: '网络保存失败:' + error,
            type: 'error'
          })
        })
    },
    async handleUploadSucc1 (response, file, id) {
      this.uploadSuccCommon(response, file, id, 'bus_assess')
    },
    async handleUploadSucc2 (response, file, id) {
      this.uploadSuccCommon(response, file, id, 'bus_salary_changes')
    },
    async handleUploadSucc3 (response, file, id) {
      this.uploadSuccCommon(response, file, id, 'bus_salary_changes2')
    },
    uploadSuccCommon (response, file, id, step) {
      if (response.success) {
        let para = {
          id: response.result[0].id,
          businessTable: step,
          businessId: id,
          theYear: this.theYear
        }
        this.$http.post(this.$http.defaults.salaryAPI + `api/salaryGenFileInfo/save`, para).then(res => {
          this.saveloading = false
          if (res.data.success === true) {
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
            switch (step) {
              case 'bus_salary_changes2':
                this.getChangeList2()
                break
              case 'bus_salary_changes':
                this.getChangeList()
                break
              case 'bus_assess':
                this.getAssessList()
                break
            }
          } else {
            console.log('上传失败:' + res.data.message)
            this.$message({
              message: '上传失败:' + res.data.message,
              type: 'error'
            })
          }
        })
          .catch(error => {
            this.saveloading = false
            console.log(error)
            this.$message({
              message: '上传失败:' + error,
              type: 'error'
            })
          })
      } else {
        this.saveloading = false
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    removeJob (id, flag) {
      let ids = []
      if (id) {
        ids = [id]
      } else {
        ids = [...this.multipleSelection]
      }
      if (ids.length > 0) {
        this.$confirm('确认删除该信息吗?', '提示', {
          type: 'error'
        }).then(() => {
          this.saveloading = true
          let url = ''
          url = flag === 'after' ? 'api/salaryBusJob/remove' : 'api/salaryBusJob2/remove'
          this.$http.post(this.$http.defaults.salaryAPI + url, {ids: ids}).then(response => {
            this.saveloading = false
            if (response.data.success === true) {
              this.$message({
                message: '删除成功',
                type: 'success'
              })
              flag === 'after' ? this.getJobList() : this.getJobList2()
            } else {
              console.log('删除失败:' + response.data.message)
              this.$message({
                message: '删除失败:' + response.data.message,
                type: 'error'
              })
            }
          })
        })
      } else {
        this.$message({
          message: '请至少选择一条信息',
          type: 'danger'
        })
      }
    },
    getJobList () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusJob/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.jobList = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getJobList2 () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusJob2/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.jobList2 = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
            this.listLoading = false
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
          this.listLoading = false
        })
    },
    editJob (obj, flag) {
      this.formTitle = '修改'
      this.jobForm = { ...obj }
      this.jobForm.jobName2 = obj.jobName2 || this.$set(this.jobForm, 'jobName2', '')
      this.jobForm.jobLevel2 = obj.jobLevel2 || this.$set(this.jobForm, 'jobLevel2', '')
      if (this.jobForm.jobName === '企业' || this.jobForm.jobName === '公务员' || this.jobForm.jobName === '待业' || this.jobForm.jobName === '上学') {
        this.$set(this.jobForm, 'jobLevel', '')
        this.jobLevelDisabled = true
      } else {
        this.jobLevelDisabled = false
      }
      if (this.jobForm.jobName2 === '不参与计算') {
        this.$set(this.jobForm, 'jobLevel2', '')
        this.jobLevelDisabled2 = true
      } else {
        this.jobLevelDisabled2 = false
      }
      if (flag === 'after') {
        this.compareBeforeOrAfter = 'after'
        this.isShowCompare = this.editForm.compareFlag
      }
      if (flag === 'before') {
        this.compareBeforeOrAfter = 'before'
        this.isShowCompare = this.editForm.compareFlag2
      }
      this.jobDrawer = true
    },
    addJob (flag) {
      this.formTitle = '新增'
      this.jobForm = {
        id: null,
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        jobDate: '',
        jobDateEnd: '',
        jobStatus: '',
        jobName: '',
        jobLevel: '',
        jobDate2: '',
        jobDateEnd2: '',
        jobName2: '',
        jobLevel2: ''
      }
      if (flag === 'after') {
        this.compareBeforeOrAfter = 'after'
        this.isShowCompare = this.editForm.compareFlag
        if (this.jobList.length > 0) {
          this.jobForm.jobDate = this.jobList[this.jobList.length - 1].jobDateEnd
        }
      }
      if (flag === 'before') {
        this.compareBeforeOrAfter = 'before'
        this.isShowCompare = this.editForm.compareFlag2
        if (this.jobList2.length > 0) {
          this.jobForm.jobDate = this.jobList2[this.jobList2.length - 1].jobDateEnd
        }
      }
      this.jobLevelDisabled = false
      this.jobLevelDisabled2 = false
      this.jobDrawer = true
    },
    jobFormReset () {
      this.jobForm = {
        id: this.approvalId ? this.approvalId : this.editForm.id,
        jobName: '',
        jobLevel: '',
        jobDate: ''
      }
    },
    // 判断比照信息是否全部为空或全部不为空
    isAllEmpty () {
      const {jobDate2, jobDateEnd2, jobName2, jobLevel2} = this.jobForm
      if (!this.jobLevelDisabled2 && jobDate2 && jobDateEnd2 && jobName2 && jobLevel2) {
        return false
      }
      if (!jobDate2 && !jobDateEnd2 && !jobName2 && !jobLevel2) {
        return false
      }
      if (this.jobLevelDisabled2 && jobDate2 && jobDateEnd2 && jobName2 && !jobLevel2) {
        return false
      }
      return true
    },
    submitJob () {
      this.$refs.jobForm.validate((valid) => {
        if (valid) {
          if (!this.jobLevelDisabled && !this.jobForm.jobLevel) {
            this.$message({
              message: '岗位等级不能为空',
              type: 'error'
            })
            return false
          }
          if (!this.isDate8(this.jobForm.jobDate) && !this.isDate6(this.jobForm.jobDate) && this.jobForm.jobDate) {
            this.$message({
              message: '任职起始时间有误，格式：20201001或202010',
              type: 'error'
            })
            return false
          }
          if (!this.isDate8(this.jobForm.jobDateEnd) && !this.isDate6(this.jobForm.jobDateEnd) && this.jobForm.jobDateEnd) {
            this.$message({
              message: '任职终止时间有误，格式：20201001或202010',
              type: 'error'
            })
            return false
          }
          if (this.compareBeforeOrAfter === 'after') {
            if (this.editForm.compareFlag) {
              const flag = this.isAllEmpty()
              if (flag) {
                this.$message({
                  message: '如有比照信息，请将比照信息填写完整',
                  type: 'error'
                })
                return false
              }
            }
          } else {
            if (this.editForm.compareFlag2) {
              const flag = this.isAllEmpty()
              if (flag) {
                this.$message({
                  message: '如有比照信息，请将比照信息填写完整',
                  type: 'error'
                })
                return false
              }
            }
          }
          if (!this.isDate8(this.jobForm.jobDate2) && !this.isDate6(this.jobForm.jobDate2) && this.jobForm.jobDate2) {
            this.$message({
              message: '比照任职起始时间有误，格式：20201001或202010',
              type: 'error'
            })
            return false
          }
          if (!this.isDate8(this.jobForm.jobDateEnd2) && !this.isDate6(this.jobForm.jobDateEnd2) && this.jobForm.jobDateEnd2) {
            this.$message({
              message: '比照任职终止时间有误，格式：20201001或202010',
              type: 'error'
            })
            return false
          }
          this.saveloading = true
          let para = {
            id: this.jobForm.id,
            approvalId: this.jobForm.approvalId,
            jobDate: this.jobForm.jobDate,
            jobDateEnd: this.jobForm.jobDateEnd,
            jobStatus: this.jobForm.jobStatus,
            jobName: this.jobForm.jobName,
            jobLevel: this.jobForm.jobLevel ? this.jobForm.jobLevel : null,
            jobDate2: this.jobForm.jobDate2 ? this.jobForm.jobDate2 : null,
            jobDateEnd2: this.jobForm.jobDateEnd2 ? this.jobForm.jobDateEnd2 : null,
            jobName2: this.jobForm.jobName2 ? this.jobForm.jobName2 : null,
            jobLevel2: this.jobForm.jobLevel2 ? this.jobForm.jobLevel2 : null
          }
          let url = ''
          url = this.compareBeforeOrAfter === 'after' ? 'api/salaryBusJob/save' : 'api/salaryBusJob2/save'
          this.$http
            .post(this.$http.defaults.salaryAPI + url, para)
            .then(response => {
              this.saveloading = false
              if (response.data.success) {
                this.$message({
                  message: '保存成功',
                  type: 'success'
                })
                this.jobFormReset()
                this.jobDrawer = false
                this.compareBeforeOrAfter === 'after' ? this.getJobList() : this.getJobList2()
              } else {
                this.$message({
                  message: '保存失败:' + response.data.message,
                  type: 'error'
                })
              }
            })
            .catch(error => {
              this.saveloading = false
              console.log(error)
              this.$message({
                message: '网络保存失败:' + error,
                type: 'error'
              })
            })
        }
      })
    },
    setAssess () {
      if (this.assess === '') {
        this.$message({
          message: '请选择考核等级',
          type: 'error'
        })
        this.saveloading = false
        return false
      }
      if (!this.editForm.jobDate) {
        this.$message({
          message: '审批表中参加工作时间未填写',
          type: 'error'
        })
        return
      }
      this.$confirm('确认批量考核吗?', '提示', {
        type: 'success'
      }).then(() => {
        let para = {
          startYear: this.editForm.jobDate.slice(0, 4),
          endYear: this.nowYear,
          approvalId: this.approvalId ? this.approvalId : this.editForm.id,
          assessLevel: this.assess
        }
        this.saveloading = true
        this.$http.post(this.$http.defaults.salaryAPI + `api/salaryBusAssess/saveBatch`, para).then(response => {
          this.saveloading = false
          if (response.data.success === true) {
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            this.getAssessList()
          } else {
            console.log('操作失败:' + response.data.message)
            this.$message({
              message: '操作失败:' + response.data.message,
              type: 'error'
            })
          }
        })
      }).catch(() => {
      })
    },
    removeAssess (id) {
      let ids = []
      if (id) {
        ids = [id]
      } else {
        ids = [...this.multipleSelection]
      }
      if (ids.length > 0) {
        this.$confirm('确认删除该信息吗?', '提示', {
          type: 'error'
        }).then(() => {
          this.saveloading = true
          this.$http.post(this.$http.defaults.salaryAPI + `api/salaryBusAssess/remove`, {ids: ids}).then(response => {
            this.saveloading = false
            if (response.data.success === true) {
              this.$message({
                message: '删除成功',
                type: 'success'
              })
              this.getAssessList()
            } else {
              console.log('删除失败:' + response.data.message)
              this.$message({
                message: '删除失败:' + response.data.message,
                type: 'error'
              })
            }
          })
        })
      } else {
        this.$message({
          message: '请至少选择一条信息',
          type: 'danger'
        })
      }
    },
    getAssessList () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusAssess/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.assessList = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    editAssess (obj) {
      this.formTitle = '修改'
      this.assessForm = { ...obj }
      this.assessForm.assessLevel = parseInt(this.assessForm.assessLevel)
      this.assessForm.theYear = this.assessForm.theYear.toString()
      this.assessDrawer = true
    },
    addAssess () {
      this.formTitle = '新增'
      this.assessForm = {
        id: null,
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        theYear: '',
        assessLevel: ''
      }
      this.assessDrawer = true
    },
    assessFormReset () {
      this.assessForm = {
        id: this.approvalId ? this.approvalId : this.editForm.id,
        theYear: '',
        assessLevel: ''
      }
    },
    submitAssess () {
      this.$refs.assessForm.validate((valid) => {
        if (valid) {
          this.saveloading = true
          let para = {
            id: this.assessForm.id,
            approvalId: this.assessForm.approvalId,
            theYear: this.assessForm.theYear,
            assessLevel: this.assessForm.assessLevel
          }
          this.$http
            .post(this.$http.defaults.salaryAPI + 'api/salaryBusAssess/save', para)
            .then(response => {
              this.saveloading = false
              if (response.data.success) {
                this.$message({
                  message: '保存成功',
                  type: 'success'
                })
                this.assessFormReset()
                this.assessDrawer = false
                this.getAssessList()
              } else {
                this.$message({
                  message: '保存失败:' + response.data.message,
                  type: 'error'
                })
              }
            })
            .catch(error => {
              this.saveloading = false
              console.log(error)
              this.$message({
                message: '网络保存失败:' + error,
                type: 'error'
              })
            })
        }
      })
    },
    removeEdu (id) {
      this.$confirm('确认删除该信息吗?', '提示', {
        type: 'error'
      }).then(() => {
        this.saveloading = true
        this.$http.post(this.$http.defaults.salaryAPI + `api/salaryBusEducation/remove`, {ids: [id]}).then(response => {
          this.saveloading = false
          if (response.data.success === true) {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.getEduList()
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
        })
      }).catch(() => {
      })
    },
    getEduList () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusEducation/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.eduList = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getChangeList () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusSalaryChanges/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.listChange = response.data.result.records
            if (this.listChange.length > 0) {
              if (this.editForm.jobClass1 === '专业技术岗位' || this.editForm.jobClass1 === '管理岗位') {
                this.isShowChangeBefore = true
              }
            }
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getChangeList2 () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusSalaryChanges2/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.listChange2 = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getAdjustList () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusAdjust/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.listAdjust = response.data.result.records
            if (this.listAdjust.length > 0) {
              if (this.editForm.jobClass1 === '专业技术岗位' || this.editForm.jobClass1 === '管理岗位') {
                this.isShowChangeBefore = true
              }
            }
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getAdjustList2 () {
      let para = {
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        pageNum: 1,
        pageSize: 1000
      }
      this.listLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + `api/salaryBusAdjust2/queryByPage`, para)
        .then(response => {
          if (response.data.success) {
            this.listLoading = false
            this.listAdjust2 = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    editEdu (obj) {
      this.formTitle = '修改'
      this.eduForm = { ...obj }
      this.eduDrawer = true
    },
    addedu () {
      this.formTitle = '新增'
      this.eduForm = {
        id: null,
        approvalId: this.approvalId ? this.approvalId : this.editForm.id,
        education: '',
        startDate: '',
        endDate: '',
        standardYears: '',
        actualYears: '',
        yearsDescription: '',
        calculateYears: ''
      }
      this.eduDrawer = true
    },
    eduFormReset () {
      this.eduForm = {
        id: this.approvalId ? this.approvalId : this.editForm.id,
        education: '',
        startDate: '',
        endDate: '',
        standardYears: '',
        actualYears: '',
        yearsDescription: '',
        calculateYears: ''
      }
    },
    submitEdu () {
      this.$refs.eduForm.validate((valid) => {
        if (valid) {
          if (!this.isDate8(this.eduForm.startDate) && !this.isDate6(this.eduForm.startDate) && this.eduForm.startDate) {
            this.$message({
              message: '入学时间有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          if (!this.isDate8(this.eduForm.endDate) && !this.isDate6(this.eduForm.endDate) && this.eduForm.endDate) {
            this.$message({
              message: '毕业时间有误，格式：20201001或202010',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          if (!this.eduForm.yearsDescription && (this.eduForm.actualYears !== this.eduForm.calculateYears)) {
            this.$message({
              message: '说明原因不能为空',
              type: 'error'
            })
            this.saveloading = false
            return false
          }
          this.saveloading = true
          let para = {
            id: this.eduForm.id,
            approvalId: this.eduForm.approvalId,
            education: this.eduForm.education,
            startDate: this.eduForm.startDate,
            endDate: this.eduForm.endDate,
            standardYears: this.eduForm.standardYears,
            actualYears: this.eduForm.actualYears,
            yearsDescription: this.eduForm.yearsDescription,
            calculateYears: this.eduForm.calculateYears
          }
          if (para.actualYears === para.calculateYears) {
            para.yearsDescription = ''
          }
          this.$http
            .post(this.$http.defaults.salaryAPI + 'api/salaryBusEducation/save', para)
            .then(response => {
              this.saveloading = false
              if (response.data.success) {
                this.$message({
                  message: '保存成功',
                  type: 'success'
                })
                this.eduFormReset()
                this.eduDrawer = false
                this.getEduList()
              } else {
                this.$message({
                  message: '保存失败:' + response.data.message,
                  type: 'error'
                })
              }
            })
            .catch(error => {
              this.saveloading = false
              console.log(error)
              this.$message({
                message: '网络保存失败:' + error,
                type: 'error'
              })
            })
        }
      })
    },
    handleRemove (file) {
      this.fileList = this.fileList.filter(item => item.id !== file.id)
    },
    handleEdit () {
      if (this.editForm.jobClass1 && this.editForm.standard1 && (this.editForm.jobClass1 === '专业技术岗位' || this.editForm.jobClass1 === '管理岗位')) {
        this.filterFun1()
      }
      if (this.editForm.jobClass2 && this.editForm.standard2) {
        this.filterFun2()
      }
      if (this.editForm.salaryLevel1) {
        this.editForm.salaryLevel1 = this.editForm.salaryLevel1 + ''
      }
      if (this.editForm.salaryLevel2) {
        this.editForm.salaryLevel2 = this.editForm.salaryLevel2 + ''
      }
      if (this.editForm.salaryLevel3) {
        this.editForm.salaryLevel3 = this.editForm.salaryLevel3 + ''
      }
      if (this.editForm.salaryLevel32) {
        this.editForm.salaryLevel32 = this.editForm.salaryLevel32 + ''
      }
      this.formType = 'edit'
    },
    handleDel () {
      this.$confirm('确认删除该信息吗?', '提示', {
        type: 'error'
      }).then(() => {
        this.saveloading = true
        this.$http.post(this.$http.defaults.salaryAPI + `api/salaryBusApproval/remove`, {ids: [this.editForm.id]}).then(response => {
          this.saveloading = false
          if (response.data.success === true) {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.editFormReset()
            this.$emit('dialogHide', true)
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
        })
      }).catch(() => {
      })
    },
    formatDate (str) {
      if (str) {
        if (str.length === 6) {
          return str.slice(0, 4) + '.' + str.slice(4, 6)
        } else {
          return str.slice(0, 4) + '.' + str.slice(4, 6) + '.' + str.slice(6, 8)
        }
      }
    },
    formatExecuteDate (str) {
      if (!str) return ''
      if (str.length === 6) {
        return str.slice(0, 4) + '年' + str.slice(4, 6) + '月'
      } else {
        return str.slice(0, 4) + '年' + str.slice(4, 6) + '月' + str.slice(6, 8) + '日'
      }
    },
    fReasonText (value) {
      let reasonText = ''
      let val = parseInt(value)
      if (val) {
        this.reasonList.forEach(item => {
          if (item.options.find(it => it.value === val)) {
            reasonText = item.label + ':' + item.options.find(it => it.value === val).label
          }
        })
      }
      return reasonText
    },
    getApprovalDetail (id) {
      let url = ''
      url = 'api/salaryBusApproval/getById'
      this.pageLoading = true
      this.$http
        .get(this.$http.defaults.salaryAPI + url + `?id=` + id)
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.editForm = response.data.result
            this.editForm.reason = parseInt(this.editForm.reason)
            this.fileList = this.formatSuccList(this.editForm.files)
            this.fileList4 = this.formatSuccList(this.editForm.files2)
            this.editForm.theYear = this.editForm.theYear.toString()
            if (this.editForm.salaryLevel1) {
              this.editForm.salaryLevel1 = this.editForm.salaryLevel1 + ''
            }
            if (this.editForm.salaryLevel2) {
              this.editForm.salaryLevel2 = this.editForm.salaryLevel2 + ''
            }
            if (this.editForm.salaryLevel3) {
              this.editForm.salaryLevel3 = this.editForm.salaryLevel3 + ''
            }
            if (this.editForm.salaryLevel32) {
              this.editForm.salaryLevel32 = this.editForm.salaryLevel32 + ''
            }
            this.editForm.compareFlag = !!this.editForm.compareFlag
            this.editForm.compareFlag2 = !!this.editForm.compareFlag2
            this.getEduList()
            this.getJobList()
            this.getJobList2()
            this.getAssessList()
            this.getAdjustList()
            this.getAdjustList2()
            this.getChangeList()
            this.getChangeList2()
            this.count1()
            this.count2()
            this.count3()
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getCurrentYear () {
      let url = ''
      url = 'api/config/getCurrentYear'
      this.$http
        .get(this.$http.defaults.salaryAPI + url)
        .then(response => {
          if (response.data.success) {
            this.nowYear = response.data.result
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getPersonDetail (id) {
      let url = ''
      url = 'api/salaryBusPerson/getById'
      this.pageLoading = true
      this.$http
        .get(this.$http.defaults.salaryAPI + url + `?id=` + id)
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            this.editForm = response.data.result
            // this.editForm.birthday = this.editForm.birthday.replace(new RegExp(/-/gm), '')
            if (this.addType === 'approval') {
              this.editForm.personId = this.editForm.id
              this.editForm.realName = this.editForm.realname
              this.editForm.id = null
            }
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    editFormReset () {
      this.passed = null
      this.bz = ''
      this.editForm = {
        id: null,
        theYear: '',
        realname: '',
        realName: '',
        idCardNo: '',
        gender: '',
        birthday: '',
        education: '',
        jobDate: '',
        currentJobDate: '',
        unitName: '',
        reason: '',
        standard1: '',
        standard2: '',
        jobClass1: '',
        jobClass2: '',
        jobLevel1: '',
        jobLevel2: '',
        jobSalary1: '',
        jobSalary2: '',
        jobSalary3: '',
        salaryLevel1: '',
        salaryLevel2: '',
        salaryLevel3: '',
        levelSalary1: '',
        levelSalary2: '',
        levelSalary3: '',
        salary1: '',
        salary2: '',
        salary3: '',
        salaryDate: '',
        remarks: '',
        description: '',
        files: []
      }
      this.fileList = []
    },
    submitPerson () {
      this.$refs.editForm.validate((valid) => {
        if (valid) {
          this.saveloading = true
          let para = {
            id: this.editForm.id,
            realname: this.editForm.realname,
            idCardNo: this.editForm.idCardNo
          }
          this.$http
            .post(this.$http.defaults.salaryAPI + 'api/salaryBusPerson/save', para)
            .then(response => {
              this.saveloading = false
              if (response.data.success) {
                this.$message({
                  message: '保存成功',
                  type: 'success'
                })
                this.editFormReset()
                this.$emit('dialogHide', true)
              } else {
                this.$message({
                  message: '保存失败:' + response.data.message,
                  type: 'error'
                })
              }
            })
            .catch(error => {
              this.saveloading = false
              console.log(error)
              this.$message({
                message: '网络保存失败:' + error,
                type: 'error'
              })
            })
        }
      })
    },
    isDate8 (sDate) {
      if (!/^[0-9]{8}$/.test(sDate)) {
        return false
      }
      var year, month, day
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      day = sDate.substring(6, 8)
      var iaMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
      if (year < 1700 || year > 2500) return false
      if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) iaMonthDays[1] = 29
      if (month < 1 || month > 12) return false
      if (day < 1 || day > iaMonthDays[month - 1]) return false
      return true
    },
    isDate6 (sDate) {
      if (!/^[0-9]{6}$/.test(sDate)) {
        return false
      }
      var year, month
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      if (year < 1700 || year > 2500) return false
      if (month < 1 || month > 12) return false
      return true
    },
    submitApproval (state, action) {
      let para = {
        id: this.editForm.id,
        personId: this.editForm.personId,
        state: state,
        theYear: this.editForm.theYear,
        realName: this.editForm.realName,
        idCardNo: this.editForm.idCardNo,
        gender: this.editForm.gender,
        birthday: this.editForm.birthday,
        education: this.editForm.education,
        jobDate: this.editForm.jobDate,
        currentJobDate: this.editForm.currentJobDate,
        unitName: this.editForm.unitName,
        reason: this.editForm.reason,
        theType: this.editForm.reason > 20 ? 2 : 1,
        standard1: this.editForm.standard1,
        standard2: this.editForm.standard2,
        jobSalary1: this.editForm.jobSalary1,
        jobSalary2: this.editForm.jobSalary2,
        levelSalary1: this.editForm.levelSalary1,
        levelSalary2: this.editForm.levelSalary2,
        jobClass1: this.editForm.jobClass1,
        jobClass2: this.editForm.jobClass2,
        jobLevel1: this.editForm.jobLevel1,
        jobLevel2: this.editForm.jobLevel2,
        salaryLevel1: this.editForm.salaryLevel1,
        salaryLevel2: this.editForm.salaryLevel2,
        salaryDate: this.editForm.salaryDate,
        remarks: this.editForm.remarks,
        description: this.editForm.description,
        description2: this.editForm.description2,
        fileIds: (this.fileList && this.fileList.length > 0) ? this.fileList.map(item => item.id) : [],
        fileIds2: (this.fileList4 && this.fileList4.length > 0) ? this.fileList4.map(item => item.id) : []
      }
      if (state === 0) {
        if (!para.reason) {
          this.$message({
            message: '变动原因不能为空',
            type: 'error'
          })
          this.$nextTick(() => {
            this.activeName = 'table'
          })
          return false
        }
        if (!para.theYear) {
          this.$message({
            message: '变动年度不能为空',
            type: 'error'
          })
          this.$nextTick(() => {
            this.activeName = 'table'
          })
          return false
        }
        this.submitCommon(para, state)
      }
      if (state === 1) {
        this.formType = 'edit'
        this.filterFun1()
        this.filterFun2()
        if (this.editForm.salaryLevel1) {
          this.editForm.salaryLevel1 = this.editForm.salaryLevel1 + ''
        }
        if (this.editForm.salaryLevel2) {
          this.editForm.salaryLevel2 = this.editForm.salaryLevel2 + ''
        }
        if (this.editForm.salaryLevel3) {
          this.editForm.salaryLevel3 = this.editForm.salaryLevel3 + ''
        }
        if (this.editForm.salaryLevel32) {
          this.editForm.salaryLevel32 = this.editForm.salaryLevel32 + ''
        }
        this.$nextTick(() => {
          this.$refs.editForm.validate((valid) => {
            if (valid) {
              if (!this.isDate8(this.editForm.birthday) && !this.isDate6(this.editForm.birthday) && this.editForm.birthday) {
                this.$message({
                  message: '出生年月格式有误，格式：20201001或202010',
                  type: 'error'
                })
                this.$nextTick(() => {
                  this.activeName = 'table'
                })
                this.saveloading = false
                return false
              }
              if (!this.isDate8(this.editForm.jobDate) && !this.isDate6(this.editForm.jobDate) && this.editForm.jobDate) {
                this.$message({
                  message: '参加工作时间格式有误，格式：20201001或202010',
                  type: 'error'
                })
                this.$nextTick(() => {
                  this.activeName = 'table'
                })
                this.saveloading = false
                return false
              }
              if (!this.isDate8(this.editForm.currentJobDate) && !this.isDate6(this.editForm.currentJobDate) && this.editForm.currentJobDate) {
                this.$message({
                  message: '任职时间格式有误，格式：20201001或202010',
                  type: 'error'
                })
                this.$nextTick(() => {
                  this.activeName = 'table'
                })
                this.saveloading = false
                return false
              }
              if (!this.isDate8(this.editForm.salaryDate) && !this.isDate6(this.editForm.salaryDate) && this.editForm.salaryDate) {
                this.$message({
                  message: '执行时间格式有误，格式：20201001或202010',
                  type: 'error'
                })
                this.$nextTick(() => {
                  this.activeName = 'table'
                })
                this.saveloading = false
                return false
              }
              if (state === 1 && this.addType === 'approval' && (this.editForm.reason !== 21 && this.editForm.reason !== 22 && this.editForm.reason !== 23 && this.editForm.reason !== 25 && this.editForm.reason !== 26 && this.editForm.reason !== 27)) {
                if (this.listChange.length === 0 && this.listAdjust.length === 0) {
                  this.$message({
                    message: '未进行薪级工资理论值测算，请将理论值测算信息填写完整，点击计算职级工资按钮，计算生成职级工资信息后再提交',
                    type: 'error'
                  })
                  this.$nextTick(() => {
                    this.activeName = 'table'
                  })
                  return false
                }
              }
              if (para.reason === 11 || para.reason === 12 || para.reason === 13) {
                if (!para.remarks) {
                  this.$message({
                    message: '备注不能为空',
                    type: 'error'
                  })
                  this.$nextTick(() => {
                    this.activeName = 'table'
                  })
                  return false
                }
                if (para.fileIds2.length === 0) {
                  this.$message({
                    message: '任职发文不能为空',
                    type: 'error'
                  })
                  this.$nextTick(() => {
                    this.activeName = 'table'
                  })
                  return false
                }
                this.submitCommon(para, state)
              } else {
                para.fileIds2 = []
                if (para.fileIds.length === 0) {
                  this.$message({
                    message: '其他证明材料不能为空',
                    type: 'error'
                  })
                  this.$nextTick(() => {
                    this.activeName = 'table'
                  })
                  return false
                } else {
                  this.submitCommon(para, state)
                }
              }
            } else {
              if (action === 'change') {
                this.$message({
                  message: '请将审批表全部项目填写完整后再填写薪金工资理论值测算信息',
                  type: 'error'
                })
                this.$nextTick(() => {
                  this.activeName = 'table'
                })
              }
            }
          })
        })
      }
    },
    submitCommon (para, state) {
      this.saveloading = true
      let saveText = (state === 1 ? '提交' : '暂存')
      this.$http
        .post(this.$http.defaults.salaryAPI + 'api/salaryBusApproval/save', para)
        .then(response => {
          this.saveloading = false
          if (response.data.success) {
            this.$message({
              message: saveText + '成功',
              type: 'success'
            })
            this.editFormReset()
            console.log('state')
            console.log(state)
            if (state) {
              this.$emit('dialogHide', true)
            } else {
              this.$emit('dialogHide', false)
              this.getApprovalDetail(response.data.result)
              this.editForm.id = response.data.result
            }
          } else {
            this.$message({
              message: saveText + '失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.saveloading = false
          console.log(error)
          this.$message({
            message: '网络' + saveText + '失败:' + error,
            type: 'error'
          })
        })
    },
    tabClick () {
      if (this.activeName === 'others') {
        this.isShowChangeBefore = false
        if (this.editForm.id) {
          this.getEduList()
          this.getJobList()
          this.getJobList2()
          this.getAssessList()
          this.getAdjustList()
          this.getAdjustList2()
          this.getChangeList()
          this.getChangeList2()
        } else {
          this.submitApproval(0, 'change')
        }
      }
    },
    beforeUpload (file) {
      console.log('文件类型')
      console.log(file.name)
      const isFormat = file.name.indexOf('.docx') > 0 || file.name.indexOf('.doc') > 0 || file.name.indexOf('.pdf') > 0 || file.name.indexOf('.DOCX') > 0 || file.name.indexOf('.DOC') > 0 || file.name.indexOf('.PDF') > 0 || file.name.indexOf('.wps') > 0 || file.name.indexOf('.WPS') > 0
      const isLt500M = file.size / 1024 / 1024 < 60
      if (!isLt500M) {
        this.$message.error('单个附件不能超过60M!')
      } else {
        if (!isFormat) {
          this.$message.error('附件格式必须为word、pdf、wps!')
        } else {
          this.saveloading = true
        }
      }
      return isFormat && isLt500M
    },
    init () {
      console.log('this.addType')
      console.log(this.addType)
      if (this.addType === 'approval') {
        this.activeName = 'table'
        this.getStandard()
        this.eduForm = {
          education: '',
          startDate: '',
          endDate: ''
        }
        this.jobForm = {
          jobName: '',
          jobLevel: '',
          jobDate: ''
        }
        this.assessForm = {
          assesscation: '',
          startDate: '',
          endDate: ''
        }
        this.listAdjust = []
        this.listChange = []
      } else {
        this.activeName = 'personInfo'
        if (this.personId) {
          this.getPersonInfo()
        }
      }
      this.jobLevelList1 = ''
      this.jobLevelList2 = ''
      this.salaryLevelList1 = ''
      this.salaryLevelList2 = ''
    },
    getStandard () {
      let para = {
        'isCurrent': 1,
        'pageNum': 1,
        'pageSize': 1000
      }
      let url = ''
      url = 'api/salaryBusStandard/queryByPage'
      this.pageLoading = true
      this.$http
        .post(this.$http.defaults.salaryAPI + url, para)
        .then(response => {
          this.pageLoading = false
          if (response.data.success) {
            if (this.personId && this.personId !== '') {
              if (this.approvalId && this.approvalId !== '') {
                this.getApprovalDetail(this.approvalId)
              } else {
                this.getPersonDetail(this.personId)
              }
            } else {
              if (this.approvalId && this.approvalId !== '') {
                this.getApprovalDetail(this.approvalId)
              }
            }
            this.standardList = response.data.result.records
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.pageLoading = false
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    formatSuccList (fileList) {
      if (fileList && fileList.length > 0) {
        const newfiles = []
        for (let i = 0; i < fileList.length; i++) {
          console.log(fileList[i])
          if (fileList[i].response) {
            newfiles.push({ name: fileList[i].response.result[0].fileName + '.' + fileList[i].response.result[0].fileType, id: fileList[i].response.result[0].id })
          } else {
            if (fileList[i].fileName) {
              newfiles.push({ name: fileList[i].fileName + '.' + fileList[i].fileType, id: fileList[i].id })
            } else {
              newfiles.push(fileList[i])
            }
          }
        }
        console.log(newfiles)
        return newfiles
      }
    },
    handleUploadSucc (response, file, fileList) {
      console.log(response)
      this.saveloading = false
      if (response.success) {
        this.fileList = this.formatSuccList(fileList)
        this.$message({
          message: '上传成功！' + response.message,
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    beforeRemove2 (file) {
      this.$confirm('确定删除' + file.fileName + '.' + file.fileType + '？', '提示', {
        type: 'warning'
      }).then(() => {
        this.handleRemove2(file.id)
      })
    },
    handleRemove2 (id) {
      const url = 'api/salaryGenFileInfo/remove?id=' + id
      this.listLoading = true
      this.$http.get(this.$http.defaults.salaryAPI + url).then(res => {
        console.log('删除成功:', res)
        this.listLoading = false
        if (res.data.success === true) {
          // this.getFileList()
          this.getAssessList()
          this.$message({
            message: '删除成功！',
            type: 'success'
          })
        }
      })
    },
    beforeRemove3 (file, flag) {
      this.$confirm('确定删除' + file.fileName + '.' + file.fileType + '？', '提示', {
        type: 'warning'
      }).then(() => {
        this.handleRemove3(file.id, flag)
      })
    },
    handleRemove3 (id, flag) {
      const url = 'api/salaryGenFileInfo/remove?id=' + id
      this.listLoading = true
      this.$http.get(this.$http.defaults.salaryAPI + url).then(res => {
        console.log('删除成功:', res)
        this.listLoading = false
        if (res.data.success === true) {
          // this.getFileList()
          flag === 'after' ? this.getChangeList() : this.getChangeList2()
          this.$message({
            message: '删除成功！',
            type: 'success'
          })
        }
      })
    },
    beforeRemove (file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`)
    },
    uploadError (err) {
      this.saveloading = false
      console.log(err)
      this.$message({
        message: '上传失败:' + err,
        type: 'error'
      })
    },
    backToList () {
      this.$emit('dialogHide', false)
    }
  },
  mounted () {
    this.getCurrentYear()
    this.init()
    console.log(this.addType)
    console.log(this.state)
    console.log(this.Formal)
    console.log(this.showDept)
    console.log(this.personId)
    console.log(this.approvalId)
    console.log(this.readOnly)
    console.log(this.timestamp)
    console.log(this.passStep)
  }
}
</script>
<style>
  #youngcadresedit .el-table{
    border: 1px solid #74A6CC;
  }
  #youngcadresedit .el-table th{
    font-weight: normal;
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
    border-right: #95B8E7 solid 1px;
    border-bottom: #95B8E7 solid 1px;
    min-height: 30px;
    line-height:30px;
  }
  #youngcadresedit .el-table tr,
  #youngcadresedit .el-table td{
    line-height: 250%;
    border-right: #95B8E7 solid 1px;
    border-bottom: #95B8E7 solid 1px;
  }
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 120px;
    height: 150px;
    line-height: 150px;
    text-align: center;
  }
  .avatar {
    width: 120px;
    height: 150px;
    display: block;
  }
  #youngcadresedit h1{
    font-size:var(--size16) !important;
    font-weight: bolder;
    height: 30px;
    border-bottom: 1px solid #95B8E7;
    font-family: '宋体';
    line-height: 30px;
    color: #000;
    padding-left:10px;
    background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
    margin:0 0 20px;
  }
  #youngcadresedit .mytable{
    border-top: 1px solid #74A6CC;
    border-left: 1px solid #74A6CC;
    margin: 10px;
    width: calc(100% - 20px);
    font-size:var(--size14) !important;
    font-family: '宋体'
  }
  #youngcadresedit .mytable th,
  #youngcadresedit .mytable td{
    padding: 10px;
    border-right: 1px solid #74A6CC;
    border-bottom: 1px solid #74A6CC;
    vertical-align:top;
    line-height: 150%;
    height: 22px;
  }
  #youngcadresedit .mytable th{
    background:#C0DCF1;
    width:120px;
    vertical-align: middle;
  }
  #youngcadresedit .mytable .passed th{
    background:#F7E4BB;
  }
  #youngcadresedit .mytable .passed td{
    background:#FBF0DB;
  }
  .youngnopic{
    background: url(../assets/nopic.gif) no-repeat;
    width: 120px;
    height: 150px;
  }
</style>
<style scoped>
.details{
  font-weight:bolder;
  border-bottom:1px solid #95B8E7;
  padding:0 10px;
  min-height: 36px;
}

.my-tooltip-reason{
  font-size: 18px;
}
</style>
